| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Just using .buffer works in these cases, but I’m not sure we should include it in our documentation like this – most of the time when you’re doing this, you’ll want to consider .byteLength and .byteOffset as well?
Sorry, something went wrong.
There was a problem hiding this comment.
I just modified the samples to work without thinking to much about it. Printing a Float64Array formatted as 'hex' is usually not a typical use. I will update the samples to use also .byteLength and .byteOffset but I'm not sure if doc of randomFillSync() is the right place to show how to work with typed arrays.
Sorry, something went wrong.
Correct return type of `crypto.randomFillSync()` which is of same type as passed as `buffer` argument. Correct samples for `randomFill()` and `randomFillSync()` using a `TypeArray` or `DataView` as these types don't support `.toString(encoding)`.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM even though I wonder if we should explain the example at least once?
Sorry, something went wrong.
Correct return type of `crypto.randomFillSync()` which is of same type as passed as `buffer` argument. Correct samples for `randomFill()` and `randomFillSync()` using a `TypeArray` or `DataView` as these types don't support `.toString(encoding)`. PR-URL: #21550 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
Correct return type of `crypto.randomFillSync()` which is of same type as passed as `buffer` argument. Correct samples for `randomFill()` and `randomFillSync()` using a `TypeArray` or `DataView` as these types don't support `.toString(encoding)`. PR-URL: #21550 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
Correct return type of crypto.randomFillSync() which is of same type as passed as buffer argument.
Correct samples for randomFill() and randomFillSync() using a TypeArray or DataView as these types don't support .toString(encoding).