Skip to content

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

Open
riderx wants to merge 4 commits into
bentonow:mainfrom
riderx:fix_support_CF_workers
Open

fix: use Alternative when Buffer not available like CF#6
riderx wants to merge 4 commits into
bentonow:mainfrom
riderx:fix_support_CF_workers

Conversation

@riderx

@riderx riderx commented Aug 14, 2024

Copy link
Copy Markdown

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

riderx commented Aug 14, 2024

Copy link
Copy Markdown
Author

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
jessehanley pushed a commit that referenced this pull request Jan 10, 2026
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