Skip to content

fs: add openAsBlobSync - #65644

Open
greenheadHQ wants to merge 1 commit into
nodejs:mainfrom
greenheadHQ:feat/open-as-blob-sync
Open

fs: add openAsBlobSync#65644
greenheadHQ wants to merge 1 commit into
nodejs:mainfrom
greenheadHQ:feat/open-as-blob-sync

Conversation

@greenheadHQ

Copy link
Copy Markdown
Contributor

This adds fs.openAsBlobSync(path[, options]) as a synchronous counterpart to fs.openAsBlob(). For real-file paths, it returns the existing file-backed Blob directly while leaving the Promise-returning API unchanged; reading the Blob's contents remains lazy and asynchronous.

This follows up on #65462. Compared with #49759, the change is additive: it does not modify fs.openAsBlob() or add an fs.promises alias.

Documentation is included. Tests cover supported path types and validation, file mutation detection, Permission Model denial, VFS mount ownership, and verify that fs.openAsBlob() still returns a Promise.

Disclosure: I used codex for research and some implementation work. I reviewed and thoroughly tested the changes myself.

Refs: #65462
Refs: #49759

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/security-wg
  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to file-system APIs and the fs module. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem. labels Aug 29, 2026
@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.07%. Comparing base (8fe4b64) to head (90fe976).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/bootstrap/switches/is_main_thread.js 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #65644   +/-   ##
=======================================
  Coverage   90.07%   90.07%           
=======================================
  Files         754      754           
  Lines      256317   256343   +26     
  Branches    48476    48483    +7     
=======================================
+ Hits       230871   230904   +33     
  Misses      16563    16563           
+ Partials     8883     8876    -7     
Files with missing lines Coverage Δ
lib/fs.js 98.44% <100.00%> (+<0.01%) ⬆️
lib/internal/vfs/setup.js 87.36% <100.00%> (+0.02%) ⬆️
lib/internal/bootstrap/switches/is_main_thread.js 90.66% <0.00%> (ø)

... and 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@daeyeon daeyeon added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. labels Aug 31, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 31, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panva panva removed the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Aug 31, 2026
Signed-off-by: greenhead <greenheadhq@gmail.com>
Assisted-by: Codex
@greenheadHQ
greenheadHQ force-pushed the feat/open-as-blob-sync branch from f8f902c to 90fe976 Compare August 31, 2026 12:20
@greenheadHQ

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest main to resolve a conflict with the recently landed #63653. The only manual conflict resolution was in the VFS test, which now uses the mount point returned by vfs.mount() and the new reserved VFS namespace.

The API scope remains unchanged. The focused fs, VFS, and Permission Model tests, along with lint and documentation tests, pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fs Issues and PRs related to file-system APIs and the fs module. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants