constructor

bun.Archive.constructor

constructor Archive(
options?: ArchiveOptions

Create an Archive instance from input data.

By default, archives are not compressed. Use { compress: "gzip" } to enable compression.

@param data

The input data for the archive:

  • Object: Creates a new tarball with the object's keys as file paths and values as file contents
  • Blob/TypedArray/ArrayBuffer: Wraps existing archive data (tar or tar.gz)
@param options

Archive options, including compression settings

From an object (creates uncompressed tarball):

const archive = new Bun.Archive({
  "hello.txt": "Hello, World!",
  "nested/file.txt": "Nested content",
});