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

feat: improve handling string or buffer #2

Closed
easymikey opened this issue Dec 31, 2024 · 4 comments · Fixed by #4
Closed

feat: improve handling string or buffer #2

easymikey opened this issue Dec 31, 2024 · 4 comments · Fixed by #4

Comments

@easymikey
Copy link
Contributor

easymikey commented Dec 31, 2024

Maybe it's worth switching to new standards for string or buffer processing? This will improve deno support.

From

const c of content.toString()

To

const c of new TextDecoder().decode(content)
@easymikey easymikey changed the title improve handling string improve handling string or buffer Dec 31, 2024
@antonmedv
Copy link
Member

Makes sense.

@easymikey
Copy link
Contributor Author

Makes sense.

Reopen it?

@easymikey easymikey reopened this Dec 31, 2024
@easymikey
Copy link
Contributor Author

@antongolub what do you think? Should we add some context?

 const _content = Buffer.isBuffer(content)
    ? new TextDecoder().decode(content)
    : content;

Buffer.toString() vs TextDecoder.decode() performance

@antongolub
Copy link
Member

Reasonable. Send a PR plz.

@easymikey easymikey changed the title improve handling string or buffer feat: improve handling string or buffer Jan 10, 2025
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 a pull request may close this issue.

3 participants