fix: legacy - use Buffer.from() instead of btoa()
Description
Fix homepage example for "Work with Threads":
btoa("") is a legacy function, Buffer.from("").toString("base64") should be used instead.
Validation
Related Issues
Check List
- [x] I have read the Contributing Guidelines and made commit messages that follow the guideline.
- [x] I have run
npx turbo formatto ensure the code follows the style guide. - [x] I have run
npx turbo testto check if all tests are passing. - [x] I have run
npx turbo buildto check if the website builds without errors. - [x] I've covered new added functionality with unit tests if necessary.
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 |
The reason why we're using btoa here is for simplicity, by adding imports to Buffer the snippet becomes even more convoluted.
I understand that, though it’s awkward if the official homepage shows deprecated/legacy examples
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.
@Luna-devv do you want to make amends to this PR?