Commit Graph

18 Commits

Author SHA1 Message Date
Xuguang Mei
46b633f441
buffer: improve Blob constructor error message when passing a string
resolve: https://github.com/nodejs/node/issues/38856

PR-URL: https://github.com/nodejs/node/pull/42338
Fixes: https://github.com/nodejs/node/issues/38856
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-04-04 20:14:39 +01:00
Antoine du Hamel
560cbc5849
stream: expose web streams globals, remove runtime experimental warning
PR-URL: https://github.com/nodejs/node/pull/42225
Fixes: https://github.com/nodejs/node/issues/40950
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2022-04-04 09:36:54 +01:00
Xuguang Mei
38626e7f5d
buffer: improve blob read performance
Fix: https://github.com/nodejs/node/issues/42108

PR-URL: https://github.com/nodejs/node/pull/42117
Fixes: https://github.com/nodejs/node/issues/42108
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
2022-02-27 18:48:47 +00:00
James M Snell
99c18f4786
buffer: graduate Blob from experimental
It's time.

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/41270
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2021-12-24 07:26:25 -08:00
Rich Trott
29f714b152 lib,tools: remove empty lines between JSDoc tags
This is in preparation for enabling a recommended JSDoc lint rule.

PR-URL: https://github.com/nodejs/node/pull/41147
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-12-19 05:30:09 +00:00
Rich Trott
88dd9724b0 lib: include return types in JSDoc
Add types to @returns JSDoc annotations where the type is missing.

PR-URL: https://github.com/nodejs/node/pull/41130
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2021-12-12 03:51:00 +00:00
Irakli Gozalishvili
2e1fa8ab28
buffer: fix Blob constructor on various TypedArrays
Fixes: https://github.com/nodejs/node/issues/40705
    
PR-URL: https://github.com/nodejs/node/pull/40706
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-12-11 00:36:20 +01:00
James M Snell
5401e96e5d
lib: propagate abortsignal reason in new AbortError constructor in blob
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/41008
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-12-02 12:14:14 -08:00
Ruben Bridgewater
9121bb301f
lib: do not lazy load EOL in blob
This addresses a comment by loading the EOL from the constants file.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/41004
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-12-02 06:02:01 +00:00
James M Snell
fcf8ba4269
buffer: add endings option, remove Node.js specific encoding option
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/39708
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-08-14 07:23:54 -07:00
James M Snell
31d1d0c4c1
url,buffer: implement URL.createObjectURL
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/39693
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2021-08-12 07:23:15 -07:00
James M Snell
0bb2605f85
buffer: add Blob.prototype.stream method and other cleanups
Adds the `stream()` method to get a `ReadableStream` for the `Blob`.
Also makes some other improvements to get the implementation closer
to the API standard definition.

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/39693
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2021-08-12 07:23:10 -07:00
Antoine du Hamel
7919ced0c9
lib: harden lint checks for globals
PR-URL: https://github.com/nodejs/node/pull/38419
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-04-28 13:13:23 -07:00
Michaël Zasso
bd4d9ef637
buffer: make Blob's constructor more spec-compliant
PR-URL: https://github.com/nodejs/node/pull/37361
Fixes: https://github.com/nodejs/node/issues/37352
Fixes: https://github.com/nodejs/node/issues/37356
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-02-17 14:08:28 +01:00
Michaël Zasso
6b289853b2
buffer: make Blob's slice method more spec-compliant
PR-URL: https://github.com/nodejs/node/pull/37361
Fixes: https://github.com/nodejs/node/issues/37335
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-02-17 14:07:57 +01:00
cjihrig
a7ba592483
buffer: add @@toStringTag to Blob
This commit adds the toStringTag to the Blob class to match
the behavior of Chrome and Firefox.

PR-URL: https://github.com/nodejs/node/pull/37336
Fixes: https://github.com/nodejs/node/issues/37337
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-02-15 10:35:32 -05:00
cjihrig
17467d15f8
util: add internal createDeferredPromise()
The pattern of resolving/rejecting a Promise from outside of its
executor happens numerous times throughout the codebase (more than
what is updated here in fact). This commit abstracts that logic
into an internal utility function.

PR-URL: https://github.com/nodejs/node/pull/37095
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-01-29 09:50:34 -05:00
James M Snell
d4bea09a0a
buffer: introduce Blob
The `Blob` object is an immutable data buffer. This is a first step
towards alignment with the `Blob` Web API.

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/36811
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-01-18 13:55:25 -08:00