Socket
Book a DemoInstallSign in
Socket

@hono/bun-compress

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hono/bun-compress

A Hono middleware for compressing responses using Bun's built-in compression.

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
1.8K
-69.6%
Maintainers
1
Weekly downloads
 
Created
Source

Bun Compress Middleware for Hono

Bun does not currently support the CompressionStream API so this middleware replicates the behavior of hono/compress using the Zlib library. This middleware will be deprecated once Bun adds support for CompressionStream.

This middleware will use hono/compress if CompressionStream is available so you can use this middleware in Bun and Node.js without any changes.

Import

import { Hono } from 'hono'
import { compress } from '@hono/bun-compress'

Usage

const app = new Hono()

app.use(compress())

Options

encoding: 'gzip' | 'deflate'

The compression scheme to allow for response compression. Either gzip or deflate. If not defined, both are allowed and will be used based on the Accept-Encoding header. gzip is prioritized if this option is not provided and the client provides both in the Accept-Encoding header.

threshold: number

The minimum size in bytes to compress. Defaults to 1024 bytes.

FAQs

Package last updated on 12 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts