Skip to content

fix: switch isBrowser to Buffer existance check#121

Closed
nperez0111 wants to merge 1 commit into
dmonad:mainfrom
nperez0111:buffer-check
Closed

fix: switch isBrowser to Buffer existance check#121
nperez0111 wants to merge 1 commit into
dmonad:mainfrom
nperez0111:buffer-check

Conversation

@nperez0111

Copy link
Copy Markdown

I was trying to use the base64 encode & decode utilities within a WebWorker, which does not have access to the window or document global variables. I thought that a better check for these was actually to guard on the existance of a Buffer function.

This should work in more runtimes (e.g. Deno & Bun), while also being slightly more correct.

@dmonad

dmonad commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Makes total sense.

I plan to separate browser and node environment (and deno etc.. ) into separate modules. That's why I want to keep the env-check in-place, rather duck typing whether Buffer is available (which might be polyfilled).

I fixed this in the commit above and will make a release shortly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants