nodejs / nodejs/node

Support providing AbortSignal to the `fs.stat` functions

Open
#57,751 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

What is the problem this feature will solve?

Currently fs.stat does not support providing an AbortSignal to fail-fast during teardown, unlike basically all other fs operations

What is the feature you are proposing to solve the problem?

That the StatOptions object have a new field signal?: AbortSignal and when that signal emits an "abort" event the underlying OS FS actions is aborted an the callback parameter of stat is called with an AbortError and undefined.

Futhermore, the async version of stat would also support this option but instead would reject the promise with an AbortError.

What alternatives have you considered?

None, this needs to be implemented within the VM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the fs.stat and StatOptions entry points, then compare how existing fs operations accept AbortSignal and propagate AbortError. Done means callback-based stat returns AbortError and undefined after abort, while the promise-based version rejects with AbortError and the underlying filesystem action stops.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
backend-api-design, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.