[Solved] Atob/btoa on server side


I’m trying to user atob and btoa on the server side. Specifically, trying to use it to handle a HTTP request with restivus.

So have some code for a post() method on server side. A HTTP msg comes in. But one of the fields is base64 encoded. What would be the recommended solution here? (a) global buffer (trying to avoid this) (b) polyfill? © import atob package?

The problem is that atob and btoa are only on the browser, and Buffer is not recommend due to size? An assist would be appreciated.



Node does not have, or expect to have, atob and btoa, hence is not available sever side. This is becuase these methods are provided by a browser normally, and not by whatever is on the server. Simple solution, do a meteor npm install --save atob btoa and then it is possible to use this as expected. The packages are just wrappers on the original implementations.