Skip to content

Allow ArrayBuffer as argument to writeFile and friends #42228

Closed as not planned
@Jamesernator

Description

@Jamesernator

What is the problem this feature will solve?

Currently one can write a large number of types to a file. However one cannot currently write an ArrayBuffer to a file without wrapping it in a typed array.

It would be convenient to be able to write an ArrayBuffer directly to a file if one is received from some library without having to wrap directly. (The fact this isn't possible is something I forget pretty much everytime I go to write an ArrayBuffer).

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

I propose allowing fs.promises.writeFile("./some-file", someArrayBuffer) to work when someArrayBuffer is an ArrayBuffer. Typed arrays and such are already supported, so this shouldn't be particularly complicated to implement.

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.fsIssues and PRs related to the fs subsystem / file system.stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions