question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Base64 is not defined in Node.js environment

See original GitHub issue

JSONC.js:275

return Base64.encode(String.fromCharCode.apply(String, gzip.zip(str,{level:9})));

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:7

github_iconTop GitHub Comments

7reactions
jamesearlcommented, Jul 19, 2018

Or you can do something like this, before you try to call a function that depends on these:

global.Base64 = {
  encode: function(str) {
    return Buffer.from(str).toString('base64');
  },
};
global.gzip = {
  zip: function(str) {
    return zlib.gzipSync(Buffer.from(str));
  },
}

Hacky but it gets the job done.

3reactions
CocaCola183commented, Jun 7, 2017

may be gzip is not defined too

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I do Base64 encoding in Node.js? - Stack Overflow
'binary' - A way of encoding raw binary data into strings by using only the first 8 bits of each character. This encoding...
Read more >
Base64 Encode and Decode in Node.js - eloquent code
The functions are defined in JavaScript in the browser, but not in server-side Node.js. To encode to base-64, instead of btoa use the...
Read more >
js-base64 - npm
Start using js-base64 in your project by running `npm i js-base64`. There are 2471 other projects in the npm registry using js-base64.
Read more >
AWS Lambda function errors in Node.js
This page describes how to view Lambda function invocation errors for the Node.js runtime using the Lambda console and the AWS CLI.
Read more >
Node.js - Hack Sparrow
How to Base64 encode and decode in Node.js Here is how you encodetext to base64 in Node.js: var b = new Buffer('JavaScript'); var...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found