From 0dcc1a19b3aa2b2b60e7b81e82e2b61eb2b1e1d1 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 17 Dec 2022 13:08:20 -0800 Subject: [PATCH] src: update Blob implementation to use DataQueue / File-backed Blobs Co-authored-by: flakey5 <73616808+flakey5@users.noreply.github.com> --- doc/api/fs.md | 9 + lib/internal/blob.js | 134 +++-- lib/internal/fs/promises.js | 10 + src/async_wrap.h | 2 +- src/env_properties.h | 6 + src/node_blob.cc | 457 ++++++++------- src/node_blob.h | 102 ++-- test/cctest/test_dataqueue.cc | 544 ++++++++++++++++++ test/parallel/test-blob-file-backed.js | 47 ++ test/parallel/test-blob.js | 1 - test/sequential/test-async-wrap-getasyncid.js | 2 +- 11 files changed, 989 insertions(+), 325 deletions(-) create mode 100644 test/cctest/test_dataqueue.cc create mode 100644 test/parallel/test-blob-file-backed.js diff --git a/doc/api/fs.md b/doc/api/fs.md index d3d4e2bd389eeb..c92471eefd5cfc 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -202,6 +202,15 @@ When operating on file handles, the mode cannot be changed from what it was set to with [`fsPromises.open()`][]. Therefore, this is equivalent to [`filehandle.writeFile()`][]. +#### `filehandle.blob()` + + +> Stability: 1 - Experimental + +Returns a {Blob} whose data is backed by this file. + #### `filehandle.chmod(mode)`