method

bun.Archive.write

static write(
path: string,
options?: ArchiveOptions
): Promise<void>;

Create an archive and write it to disk in one operation.

The data streams directly to disk, which is more efficient than creating an archive and then writing it separately.

@param path

The file path to write the archive to

@param data

The input data for the archive (same as new Archive())

@param options

Optional archive options including compression settings

@returns

A promise that resolves when the write is complete

Write uncompressed tarball:

await Bun.Archive.write("output.tar", {
  "file1.txt": "content1",
  "file2.txt": "content2",
});