Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-browser use error: ReferenceError: Buffer is not defined #41

Closed
vladimiry opened this issue Jan 23, 2021 · 1 comment · Fixed by #42
Closed

In-browser use error: ReferenceError: Buffer is not defined #41

vladimiry opened this issue Jan 23, 2021 · 1 comment · Fixed by #42

Comments

@vladimiry
Copy link
Contributor

vladimiry commented Jan 23, 2021

Occurring on the line

if (Buffer.isBuffer(value)) {

Introduced in #39 CC @OfryL

Proposed fix: if (Buffer.isBuffer(value)) { => if (typeof Buffer !== "undefined" && Buffer.isBuffer(value)) {

@vladimiry
Copy link
Contributor Author

vladimiry commented Jan 23, 2021

@fregante, typeof Buffer call returns function in nodejs env in my case, not the object, so I proposed to use just typeof Buffer !== "undefined" test. The nodejs doc says The Buffer class is a subclass of ..., so function type makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants