Plugins
Compression
Gzip/deflate response compression hints via a wrap middleware.
The compression wrap attaches encoding hints to the context for transport-level compression. Most useful with handler() and custom servers where you control response encoding.
Usage
import { } from 'silgi/plugins'
const = s.$use(()).$resolve(({ }) => .db.users.findMany())Options
| Option | Type | Default | Description |
|---|---|---|---|
threshold | number | 1024 | Minimum response size in bytes before compressing |
encoding | "gzip" | "deflate" | "gzip" | Preferred encoding |
Custom threshold
const = compressionWrap({
: 512, // compress responses > 512 bytes
: 'deflate',
})With serve(), Node.js handles compression at the HTTP level. This wrap is primarily for handler()-based
deployments (Cloudflare Workers, Bun, Deno) where you manage response encoding yourself.