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

fix: use Alternative when Buffer not available like CF #6

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

riderx
Copy link

@riderx riderx commented Aug 14, 2024

This PR allow fixing the bug I have in production env where I deploy on Cloudflare workers, as documented here:
https://developers.cloudflare.com/workers/runtime-apis/nodejs/buffer/
We cannot use Buffer without explicit import.
The problem is: This lib builds for deprecated Nodejs versions 12 and 14 who don't have the explicit import yet.
So I created a function who can use Buffer or btoa if available.
This makes the lib fully portable. As we already use Cross fetch

@riderx
Copy link
Author

riderx commented Aug 14, 2024

I would suggest updating to min node 18 as it's the one in maintenance.
And update the test to run on modern versions. I could make it if needed.
That a bit more work

@riderx riderx changed the title fix: add explicit import to support CF workers fix: use Alternative when Buffer not available like CF Aug 14, 2024
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.

1 participant