Skip to content

[pull] main from nodejs:main#751

Merged
pull[bot] merged 2 commits intoadamlaska:mainfrom
nodejs:main
Feb 7, 2026
Merged

[pull] main from nodejs:main#751
pull[bot] merged 2 commits intoadamlaska:mainfrom
nodejs:main

Conversation

@pull
Copy link

@pull pull bot commented Feb 7, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

pimterry and others added 2 commits February 6, 2026 22:37
PR-URL: #61675
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
This patch moves `ReadFileSync` and `WriteFileSync` from
`src/util.cc` to `src/node_file_utils.cc`, consolidates
the implementation to reuse code, and adds a few more
enhancements:

For `ReadFileSync`:

- Use fstat-based pre-allocation to minimize buffer resizing
  and repeated reads for bigger files.
- Handle various potential overflows in size conversions.
- Handle fallback for 0-byte special files.

For `WriteFileSync`:

- Handle potential partial writes for big enough files and
  support non-seekable files (with -1 as offset).
- Handle 0-byte writes correctly.

In both cases, this now avoids hard aborts and return error code
for the caller to handle as much as possible, except
`std::vector<char> ReadFileSync(FILE* fp)` which is part of the
embedder API.

This patch uses the new `ReadFileSync` to address a TODO in
node_sea.bin.cc.

PR-URL: #61662
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@pull pull bot locked and limited conversation to collaborators Feb 7, 2026
@pull pull bot added the ⤵️ pull label Feb 7, 2026
@pull pull bot merged commit 3ab9dd8 into adamlaska:main Feb 7, 2026
0 of 4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants