> ## Documentation Index
> Fetch the complete documentation index at: https://code.storage/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# repo.getArchiveStream()

> Download a repository archive as a streaming tar.gz response.

> [!WARNING]
>
> This page documents the earlier Code Storage SDKs: `@pierre/storage`, `pierre-storage`, and
> `code-storage-go`. New code uses the [Pierre SDK](https://code.storage/docs/sdks.md). To move code to the new SDK, use the
> [`pierre-migrate`
> skill](https://github.com/pierrecomputer/skills/tree/main/skills/pierre-migrate).

```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
// Download a full repository archive from the default branch
const archiveResp = await repo.getArchiveStream();
const archiveBytes = new Uint8Array(await archiveResp.arrayBuffer());
console.log(archiveBytes.length);

// Download from a specific branch, tag, or commit with filters
const filteredArchiveResp = await repo.getArchiveStream({
  ref: 'main',
  includeGlobs: ['README.md', 'src/**'],
  excludeGlobs: ['vendor/**'],
  maxBlobSize: 1024 * 1024, // 1 MiB
  archivePrefix: 'repo/',
});
const filteredBytes = new Uint8Array(await filteredArchiveResp.arrayBuffer());
console.log(filteredBytes.length);
```

```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
# Download a full repository archive from the default branch
archive_response = await repo.get_archive_stream()
archive_bytes = await archive_response.aread()
print(len(archive_bytes))

# Download from a specific branch, tag, or commit with filters
filtered_archive_response = await repo.get_archive_stream(
    ref="main",
    include_globs=["README.md", "src/**"],
    exclude_globs=["vendor/**"],
    max_blob_size=1024 * 1024,  # 1 MiB
    archive_prefix="repo/",
)
filtered_archive_bytes = await filtered_archive_response.aread()
print(len(filtered_archive_bytes))
```

```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
// Download a filtered archive
resp, err := repo.ArchiveStream(context.Background(), storage.ArchiveOptions{
	Ref:           "main",
	IncludeGlobs:  []string{"README.md", "src/**"},
	ExcludeGlobs:  []string{"vendor/**"},
	MaxBlobSize:   1024 * 1024, // 1 MiB
	ArchivePrefix: "repo/",
})
defer resp.Body.Close()
archiveBytes, err := io.ReadAll(resp.Body)
fmt.Println(len(archiveBytes))
```

## Options

**ref** `string`

Branch name, tag, or commit SHA. Defaults to the default branch.

**includeGlobs** `string`

Glob patterns for files to include in the archive.

**excludeGlobs** `string`

Glob patterns for files to exclude from the archive.

**maxBlobSize** `number`

Maximum blob size in bytes. When provided, files larger than this limit are excluded from the
archive.

**archivePrefix** `string`

Prefix to add to each entry in the tar archive (e.g., `repo/`).

## Returns

Returns a streaming response containing a `tar.gz` archive.

* **TypeScript:** Standard Fetch `Response`.
* **Python:** Async response object with `.aread()` for bytes.
* **Go:** `*http.Response` (remember to close `Body`).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.