Skip to content

fix(ext/node): add openAsBlob export to node:fs#32261

Merged
bartlomieju merged 2 commits intodenoland:mainfrom
bartlomieju:fix/node-fs-openAsBlob
Feb 23, 2026
Merged

fix(ext/node): add openAsBlob export to node:fs#32261
bartlomieju merged 2 commits intodenoland:mainfrom
bartlomieju:fix/node-fs-openAsBlob

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Summary

  • Implements fs.openAsBlob() which reads a file and returns a Promise<Blob>, matching the Node.js API
  • Adds the function to both named and default exports of node:fs
  • Adds unit tests covering basic usage, the type option, and error handling for non-existent files

Closes #31036

Test plan

  • cargo test unit_node::fs_test passes
  • Manual verification: import { openAsBlob } from "node:fs" works correctly
  • Lint and format checks pass

🤖 Generated with Claude Code

Implements `fs.openAsBlob()` which returns a Promise<Blob> containing
the file's data, matching the Node.js API.

Closes denoland#31036

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@Tango992 Tango992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju merged commit 52a2337 into denoland:main Feb 23, 2026
216 of 218 checks passed
@bartlomieju bartlomieju deleted the fix/node-fs-openAsBlob branch February 23, 2026 15:38
@qupig
Copy link
Copy Markdown

qupig commented Feb 25, 2026

If I understand correctly, the implementation is to read the file completely into memory.

This is inconsistent with browser and nodejs behavior and makes the API much less useful.

@jimmywarting explicitly states and recommends this in every post:

@bartlomieju
Copy link
Copy Markdown
Member Author

Thanks I just started the release so it's gonna be fixed in a patch release.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:fs doesn't have openAsBlob export

3 participants