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: legacy - use Buffer.from() instead of btoa() #6521

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Luna-devv
Copy link

@Luna-devv Luna-devv commented Mar 24, 2024

Description

Fix homepage example for "Work with Threads":
btoa("") is a legacy function, Buffer.from("").toString("base64") should be used instead.

image

Validation

Related Issues

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npx turbo format to ensure the code follows the style guide.
  • I have run npx turbo test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

`btoa("")` is a legacy function, `Buffer.from("").toString("base64")` should be used instead

Signed-off-by: Luna <luni.siaa@gmail.com>
@Luna-devv Luna-devv requested a review from a team as a code owner March 24, 2024 12:14
Copy link

vercel bot commented Mar 24, 2024

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

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Mar 24, 2024 0:16am

@ovflowd
Copy link
Member

ovflowd commented Mar 24, 2024

The reason why we're using btoa here is for simplicity, by adding imports to Buffer the snippet becomes even more convoluted.

@Luna-devv
Copy link
Author

I understand that, though it’s awkward if the official homepage shows deprecated/legacy examples

@ovflowd
Copy link
Member

ovflowd commented Mar 24, 2024

I understand that, though it’s awkward if the official homepage shows deprecated/legacy examples

Maybe, but it's just a silly example. The important part is the worker communication. For all intends and purposes we can remove btoa and simply do .toUppercase()

The intent was just to show that a separate worker would handle the "work" and that it can work on the "data" you've initially sent.

@ovflowd
Copy link
Member

ovflowd commented Mar 28, 2024

@Luna-devv do you want to make amends to this PR?

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.

None yet

2 participants