Mfiles
Bun

method

Archive.files

glob?: string | readonly string[]
): Promise<Map<string, File>>;

Get the archive contents as a Map of File objects.

Each file in the archive is returned as a File object with:

  • name: The file path within the archive
  • lastModified: The file's modification time from the archive
  • Standard Blob methods (text(), arrayBuffer(), stream(), etc.)

Only regular files are included; directories are not returned. File contents are loaded into memory, so for large archives consider using extract() instead.

@param glob

Optional glob pattern(s) to filter files. Supports the same syntax as Bun.Glob, including negation patterns (prefixed with !). Patterns are matched against paths normalized to use forward slashes (/).

@returns

A promise that resolves with a Map where keys are file paths (always using forward slashes / as separators) and values are File objects

Get all files:

const entries = await archive.files();
for (const [path, file] of entries) {
  console.log(`${path}: ${file.size} bytes`);
}

Referenced types

class File

Provides information about files and allows JavaScript in a web page to access their content.

MDN Reference