-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
doc: add documentation for blob.bytes() method #54114
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! The added doc is incorrect and this PR can be improved as the following:
blob.bytes()
returns aPromise<Uint8Array>
instead ofBuffer
- remove the unrelated file change as other reviewer pointed (remove
test.txt
) - please follow the commit message guide line where you can find it here in this case I would suggest commit message to be
doc: add documentation for blob.bytes() method
Please let me know if you need any assistance!
9c182c6
to
abbeb38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback. I have made the following changes as per the suggestions:
- Removed the unrelated
test.txt
file. - Updated the
blob.bytes()
method documentation to reflect the correct return type ofPromise<Uint8Array>
.
blob.bytes()
The blob.bytes()
method returns the bytes of the Blob
object as a Promise<Uint8Array>
.
const blob = new Blob(['hello']);
blob.bytes().then((bytes) => {
console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
});
Please let me know if there are any additional changes required. Thanks!
abbeb38
to
67c5e51
Compare
Do you mind squashing your 2 commits into 1 commit? |
Add documentation for blob.bytes() method doc: add documentation for blob.bytes() method
67c5e51
to
3a25717
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have squashed the 2 commits into 1 commit as requested. Please let me know if there are any additional changes required. Thank you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the version information as you requested. Thank you for pointing that out. If there are any further changes needed, please let me know. I apologize for any inconvenience caused.
No worries about the mistakes, you have been doing well! There is a pipeline failure due to linting, do you mind looking into it? 👀 Should be an easy fix! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just made the corrections you mentioned. As this is my first time, it's been challenging, but thanks to your help, I'm managing to get through it step by step. Thank you very much!
198bfa6
to
6574a6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reset the branch to the correct commit (6574a6a) and force-pushed the changes. The incorrect commit (198bfa6) has been removed. Thank you for your guidance!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved the blob.bytes()
entry after blob.arrayBuffer
so that it is in alphabetical order. Please let me know if there are any additional changes required. Thank you!
doc/api/buffer.md
Outdated
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc/api/buffer.md
Outdated
}); | ||
``` | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc/api/buffer.md
Outdated
added: | ||
- v20.16.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added: | |
- v20.16.0 | |
added: | |
- v22.3.0 | |
- v20.16.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reflected your comments. Thank you!
Commit Queue failed- Loading data for nodejs/node/pull/54114 ✔ Done loading data for nodejs/node/pull/54114 ----------------------------------- PR info ------------------------------------ Title doc: add documentation for blob.bytes() method (#54114) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch jmsb02:add-blob-bytes-doc -> nodejs:main Labels author ready, commit-queue-squash Commits 5 - doc: add documentation for blob.bytes() method - doc: add documentation for blob.bytes() method - doc: add documentation for blob.bytes() method - doc: add documentation for blob.bytes() method - doc: add documentation for blob.bytes() method Committers 1 - jaexxin <jmsb02@naver.com> PR-URL: https://github.com/nodejs/node/pull/54114 Fixes: https://github.com/nodejs/node/issues/54105 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/54114 Fixes: https://github.com/nodejs/node/issues/54105 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> -------------------------------------------------------------------------------- ℹ This PR was created on Tue, 30 Jul 2024 06:37:26 GMT ✔ Approvals: 1 ✔ - Daeyeon Jeong (@daeyeon): https://github.com/nodejs/node/pull/54114#pullrequestreview-2217050112 ✘ This PR needs to wait 65 more hours to land (or 0 hours if there is one more approval) ✔ Last GitHub CI successful ℹ Green GitHub CI is sufficient -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/10228146599 |
Landed in 76d10a1 |
Hi @jmsb02 I manually landed the PR for you as your first commit message body contains duplicated information. Congrats to become a contributor 🥳 |
Description:
This pull request adds documentation for the blob.bytes() method in the buffer module. The method was introduced in Node.js v20.16.0, but it was not documented. This PR aims to provide a clear description and examples for the blob.bytes() method.
Motivation:
The blob.bytes() method allows users to obtain the bytes of a Blob object as a Buffer.
This method was introduced in a recent release but is currently undocumented.
Fixes: #54105
Documentation:
blob.bytes()
The
blob.bytes()
method returns the bytes of theBlob
object as aBuffer
.Additional Notes:
I included the text.txt file incorrectly while testing git push for the first time. I'd appreciate it if you could ignore it. I'll be more careful in the future!