Skip to content

Support appending files with Bun.write #10473

Open
@lsyuanyuan

Description

@lsyuanyuan

What is the problem this feature would solve?

I read the document and the current way Bun writes files is:

const data = `It was the best of times, it was the worst of times.`;
await Bun.write("output.txt", data);

If new content needs to be added and written, then the node: fs module needs to be used,

import { appendFile } from "node:fs/promises";

await appendFile("message.txt", "data to append");

Is it being considered to add an optional parameter to Bun.write() or introduce a new method like Bun.appendWrite() to indicate appending new content? I feel this aligns well with Bun's inherent characteristics and makes it more concise

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

Add an optional parameter to Bun.write() or introduce a similar method Bun.appendWrite()

What alternatives have you considered?

Using the solution introduced in the official documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions