# System.IO.Compression

**Kind:** Service

**Source:** `Pams/API/Pams.API/Pams.API.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`System.IO.Compression` is a NuGet package dependency declared by `Pams.API`. It supports compression and archive processing when the API reads or writes compressed streams and files.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant API as Pams.API
    participant Compression as System.IO.Compression

    Client->>API: Request data or archive
    API->>Compression: Create or read compressed stream
    Compression-->>API: Compressed bytes or extracted content
    API-->>Client: Return HTTP response
```

## Usage

```ts
async function downloadArchive(downloadUrl: string): Promise<Blob> {
  const response = await fetch(downloadUrl);

  if (!response.ok) {
    throw new Error(`Download failed: ${response.status}`);
  }

  return response.blob();
}

const archive = await downloadArchive("/api/export");

const link = document.createElement("a");
link.href = URL.createObjectURL(archive);
link.download = "export.zip";
link.click();

URL.revokeObjectURL(link.href);
```

## AI Coding Instructions

- Keep compression and archive handling inside the .NET API; TypeScript clients should consume the returned HTTP response.
- Add or update the NuGet package reference in `Pams.API.csproj` when changing dependency versions.
- Use streams for compressed content rather than loading archive data into memory when possible.
- Dispose compression streams and archive objects after reading or writing data.
- Confirm HTTP response headers match the returned archive or compressed content.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (1)

- `Pams.API` — `Pams/API/Pams.API/Pams.API.csproj`:1
