Remove dependency on Buffer for non-Node.js environments#34
Merged
good-lly merged 2 commits intogood-lly:devfrom Aug 24, 2025
Merged
Remove dependency on Buffer for non-Node.js environments#34good-lly merged 2 commits intogood-lly:devfrom
Buffer for non-Node.js environments#34good-lly merged 2 commits intogood-lly:devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a continuation of #33. Kinda.
Running the following minimal code with Wrangler used to fail with a
ReferenceError:This is because
Bufferis not part of base ECMAScript but an extension by Node.js. Now that s3mini only relies on Web Crypto APIs, this tries to remove another Node.js dependency and make it possible to use it in more environments.BodyInitfor its request body value, this should always be compatible withfetch().Buffers. But validation of this checks to make sure thatBufferis a thing, thus skipping these values in other environments.It might also be possible to solve this by bringing
BodyInitall the way out to the methods. But for this first PR I have chosen to keep the user inputs the same.After this change, Wrangler returns:
Which suggests it can run all the library code but does not execute the
fetch()because I am running it naively.