mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
10 lines
421 B
JavaScript
10 lines
421 B
JavaScript
|
|
var u;
|
|
if(u+''== typeof btoa){
|
|
if(u+'' == typeof Buffer){
|
|
try{ global.Buffer = require("buffer", 1).Buffer }catch(e){ console.log("Please `npm install buffer` or add it to your package.json !") }
|
|
}
|
|
global.btoa = function(data){ return Buffer.from(data, "binary").toString("base64") };
|
|
global.atob = function(data){ return Buffer.from(data, "base64").toString("binary") };
|
|
}
|
|
|