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

[data-uri-to-buffer] Refactor to return an ArrayBuffer instead of a Node.js Buffer #252

Merged
merged 2 commits into from Sep 30, 2023

Conversation

TooTallNate
Copy link
Owner

Refactor to return an ArrayBuffer instead of a Node.js Buffer.

This change is being made to make the package platform-agnostic, and work in web browsers or other non-Node.js environments without polyfills.

For Node.js users of this package, you can get a Node.js Buffer instance from an ArrayBuffer like so:

const uri = 'data:,Hello%2C%20World!';
const parsed = dataUriToBuffer(uri);
const buffer = Buffer.from(parsed.buffer);
// `buffer` is a Node.js Buffer

@changeset-bot
Copy link

changeset-bot bot commented Sep 30, 2023

🦋 Changeset detected

Latest commit: 5854006

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
data-uri-to-buffer Major
get-uri Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Sep 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
proxy-agents ✅ Ready (Inspect) Visit Preview Sep 30, 2023 2:22pm

@TooTallNate TooTallNate marked this pull request as ready for review September 30, 2023 14:24
@TooTallNate TooTallNate changed the title [array-buffer-to-uri] Refactor to return an ArrayBuffer instead of a Node.js Buffer [data-uri-to-buffer] Refactor to return an ArrayBuffer instead of a Node.js Buffer Sep 30, 2023
@TooTallNate TooTallNate merged commit 52b458f into main Sep 30, 2023
15 checks passed
@TooTallNate TooTallNate deleted the rewrite/data-uri-to-buffer-arraybuffer branch September 30, 2023 14:26
rowaxl pushed a commit to yumemi-makiyama/proxy-agents that referenced this pull request Jan 24, 2024
… Node.js `Buffer` (TooTallNate#252)

Breaking change refactor to return an `ArrayBuffer` instead of a Node.js `Buffer`.

This change is being made to make the package platform-agnostic, and work in web browsers or other non-Node.js environments without polyfills.

For Node.js users of this package, you can get a Node.js `Buffer` instance from an `ArrayBuffer` like so:

```typescript
const uri = 'data:,Hello%2C%20World!';
const parsed = dataUriToBuffer(uri);
const buffer = Buffer.from(parsed.buffer);
// `buffer` is a Node.js Buffer
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant