{"_id":"brotli-lib","_rev":"6-cd3d737f6b164852bb24755ceb589d8d","name":"brotli-lib","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.1":{"name":"brotli-lib","version":"0.0.1","keywords":["brotli","encode","decode","compress","decompress","compression","typescript","tree-shaking"],"author":{"name":"Jeremy Tribby, Countertype LLC"},"license":"MIT","_id":"brotli-lib@0.0.1","maintainers":[{"name":"tribby","email":"opensource@countertype.com"}],"dist":{"shasum":"d2b24c6dec741707e0606e573359b484b99a1c99","tarball":"https://registry.npmjs.org/brotli-lib/-/brotli-lib-0.0.1.tgz","fileCount":74,"integrity":"sha512-J9oNBZzc3GIsAj+UmM1pkKqqgF6SPAyl6IMMPOaoXQGGh65tWpaiGgRteyoX6qRGiHJkTmA0R/QEewTNmPyWRA==","signatures":[{"sig":"MEUCIAp66fwMNJy4NagfPXEpc2YwX+QGH3NSN7ONi/0zeFKdAiEAvkqSqBlHdFlmZ5iPXd5QuAIIjYcU12SkvdN1WVcMPrE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":963495},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=12"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./decode":{"types":"./dist/decode.d.ts","import":"./dist/decode.js","require":"./dist/decode.cjs"},"./encode":{"types":"./dist/encode.d.ts","import":"./dist/encode.js","require":"./dist/encode.cjs"}},"gitHead":"45e350fdc29cf6f0ab4663d5da19401eef66c5da","scripts":{"test":"vitest run","bench":"vitest bench","build":"rolldown -c && tsc --emitDeclarationOnly --declaration --outDir dist","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest","bench:decode":"vitest bench bench/decode.bench.ts","bench:encode":"vitest bench bench/encode.bench.ts","prepublishOnly":"npm run clean && npm run test && npm run build"},"_npmUser":{"name":"tribby","email":"opensource@countertype.com"},"_npmVersion":"11.2.0","description":"TypeScript Brotli encoder and decoder","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"brotli":"^1.3.3","vitest":"^4.0.18","rolldown":"^1.0.0-beta.6","typescript":"^5.9.3","@types/node":"^25.1.0"},"_npmOperationalInternal":{"tmp":"tmp/brotli-lib_0.0.1_1770107925950_0.7054877682169323","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"brotli-lib","version":"0.0.2","keywords":["brotli","encode","decode","compress","decompress","compression","typescript","tree-shaking"],"author":{"name":"Jeremy Tribby, Countertype LLC"},"license":"MIT","_id":"brotli-lib@0.0.2","maintainers":[{"name":"tribby","email":"opensource@countertype.com"}],"dist":{"shasum":"e9596ac49dd33a768babaa287d97089a3517aced","tarball":"https://registry.npmjs.org/brotli-lib/-/brotli-lib-0.0.2.tgz","fileCount":74,"integrity":"sha512-4TZHrTnhnyiZ7Me8KC2GTV/J36kW4xtnPXlt68c6CY8MocJ1uljD9bkbue0mmAM8HVqUQWDhEFSiy3cNJM+Y+A==","signatures":[{"sig":"MEQCIGVfVQprPP5ccCiiS3MnhoY/r+JQwAgwDkR3eCtv8k+yAiAGWK454txvJ4jF/wcCufxN7FzuqCre/oYCV4fa3jqYfw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":969978},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=12"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./decode":{"types":"./dist/decode.d.ts","import":"./dist/decode.js","require":"./dist/decode.cjs"},"./encode":{"types":"./dist/encode.d.ts","import":"./dist/encode.js","require":"./dist/encode.cjs"}},"gitHead":"bdf7c4d7f8a45cc1ec49f87034a1405d6a9ba1af","scripts":{"test":"vitest run","bench":"vitest bench","build":"rolldown -c && tsc --emitDeclarationOnly --declaration --outDir dist","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest","bench:decode":"vitest bench bench/decode.bench.ts","bench:encode":"vitest bench bench/encode.bench.ts","prepublishOnly":"npm run clean && npm run test && npm run build"},"_npmUser":{"name":"tribby","email":"opensource@countertype.com"},"_npmVersion":"11.2.0","description":"TypeScript Brotli encoder and decoder","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"brotli":"^1.3.3","vitest":"^4.0.18","rolldown":"^1.0.0-beta.6","typescript":"^5.9.3","@types/node":"^25.1.0"},"_npmOperationalInternal":{"tmp":"tmp/brotli-lib_0.0.2_1770118489361_0.703557503840718","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"brotli-lib","version":"0.0.3","keywords":["brotli","encode","decode","compress","decompress","compression","typescript","tree-shaking"],"author":{"name":"Jeremy Tribby, Countertype LLC"},"license":"MIT","_id":"brotli-lib@0.0.3","maintainers":[{"name":"tribby","email":"opensource@countertype.com"}],"dist":{"shasum":"fc850b4c1639247b5a758eadfc15ae764b791660","tarball":"https://registry.npmjs.org/brotli-lib/-/brotli-lib-0.0.3.tgz","fileCount":74,"integrity":"sha512-ng0O3t0ko+u1DiZA3iK62fw0r5Fce17GpfYBZkVR1zz/L43j7NtNinXH5tQNKgBYK31O2GI6n4KsleEYsy5qCw==","signatures":[{"sig":"MEQCIFF2eO3ravTGCpZLszH9XtkWEaU8jrGGCU7ZIvw8FSkDAiADbJjN7hjrkqGSHz9UjONpN3Qitq8vlVRkPzeVZHDWqQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1155110},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=12"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./decode":{"types":"./dist/decode.d.ts","import":"./dist/decode.js","require":"./dist/decode.cjs"},"./encode":{"types":"./dist/encode.d.ts","import":"./dist/encode.js","require":"./dist/encode.cjs"}},"gitHead":"9f8ad7d094e9ff5f47bd5682e8fe9336de8fdf25","scripts":{"test":"vitest run","bench":"vitest bench","build":"rolldown -c && tsc --emitDeclarationOnly --declaration --outDir dist","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest","bench:decode":"vitest bench bench/decode.bench.ts","bench:encode":"vitest bench bench/encode.bench.ts","prepublishOnly":"npm run clean && npm run test && npm run build"},"_npmUser":{"name":"tribby","email":"opensource@countertype.com"},"_npmVersion":"11.2.0","description":"TypeScript Brotli encoder and decoder","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"brotli":"^1.3.3","vitest":"^4.0.18","rolldown":"^1.0.0-beta.6","typescript":"^5.9.3","@types/node":"^25.1.0"},"_npmOperationalInternal":{"tmp":"tmp/brotli-lib_0.0.3_1770174607707_0.29282762852941446","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"brotli-lib","version":"0.0.4","keywords":["brotli","encode","decode","compress","decompress","compression","typescript","tree-shaking"],"author":{"name":"Jeremy Tribby, Countertype LLC"},"license":"MIT","_id":"brotli-lib@0.0.4","maintainers":[{"name":"tribby","email":"opensource@countertype.com"}],"dist":{"shasum":"1294762e1d14462efe91aa6a3e169f4c9ab7dc9e","tarball":"https://registry.npmjs.org/brotli-lib/-/brotli-lib-0.0.4.tgz","fileCount":74,"integrity":"sha512-vroY/D55Ab8HBlunr9llwZDg0E+pHbxxfNgZJ196rGWg5IX8ZQSqYjdoo1gNsk0d5EX8BeAraep8sDOUVeIY5A==","signatures":[{"sig":"MEUCIQDwxiWOFcrv8VJtyksIuAxUoQWDiDUJNBH0nnCLa52YSAIgfBCtuQx+ZUxsYcDrsY4ADUWGvgnIckZxRmZ0ppJmd3M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1159744},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=12"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./decode":{"types":"./dist/decode.d.ts","import":"./dist/decode.js","require":"./dist/decode.cjs"},"./encode":{"types":"./dist/encode.d.ts","import":"./dist/encode.js","require":"./dist/encode.cjs"}},"gitHead":"7c922d7b3706ef1360b137fd0eceea2013a9afb4","scripts":{"test":"vitest run","bench":"vitest bench","build":"rolldown -c && tsc --emitDeclarationOnly --declaration --outDir dist","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest","bench:decode":"vitest bench bench/decode.bench.ts","bench:encode":"vitest bench bench/encode.bench.ts","prepublishOnly":"npm run clean && npm run test && npm run build"},"_npmUser":{"name":"tribby","email":"opensource@countertype.com"},"_npmVersion":"11.2.0","description":"TypeScript Brotli encoder and decoder","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"brotli":"^1.3.3","vitest":"^4.0.18","rolldown":"^1.0.0-beta.6","typescript":"^5.9.3","@types/node":"^25.1.0"},"_npmOperationalInternal":{"tmp":"tmp/brotli-lib_0.0.4_1770418405463_0.23140806151113535","host":"s3://npm-registry-packages-npm-production"}},"0.0.6":{"name":"brotli-lib","version":"0.0.6","keywords":["brotli","encode","decode","compress","decompress","compression","typescript","tree-shaking"],"author":{"name":"Jeremy Tribby, Countertype LLC"},"license":"MIT","_id":"brotli-lib@0.0.6","maintainers":[{"name":"tribby","email":"opensource@countertype.com"}],"dist":{"shasum":"798f5b85dfb41d97e196659a3c291a630950f9ee","tarball":"https://registry.npmjs.org/brotli-lib/-/brotli-lib-0.0.6.tgz","fileCount":74,"integrity":"sha512-hYHoQCVVcwX+T2ZgxgCY6QY4B5STyw1NpIMCL1WOzQGrNlua0OV08tM7Ia1qz9eZa0wn5C/pdwOS8O/aoTKN8Q==","signatures":[{"sig":"MEQCIHv+wMvZizEczPnCNHHgirhUIrE4mMTQQ0iFH8L6hCtcAiAgxvzF6ejKwGastCgw939lWCUpIbOoiVwRRB6auLwqkQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1142721},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=12"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./decode":{"types":"./dist/decode.d.ts","import":"./dist/decode.js","require":"./dist/decode.cjs"},"./encode":{"types":"./dist/encode.d.ts","import":"./dist/encode.js","require":"./dist/encode.cjs"}},"gitHead":"53730db2ec09b6ded3dbffb16e46a60df8dc56fb","scripts":{"test":"vitest run","bench":"vitest bench","build":"rolldown -c && tsc --emitDeclarationOnly --declaration --outDir dist","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest","bench:decode":"vitest bench bench/decode.bench.ts","bench:encode":"vitest bench bench/encode.bench.ts","prepublishOnly":"npm run clean && npm run test && npm run build"},"_npmUser":{"name":"tribby","email":"opensource@countertype.com"},"_npmVersion":"11.2.0","description":"TypeScript Brotli encoder and decoder","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"brotli":"^1.3.3","vitest":"^4.0.18","rolldown":"^1.0.0-beta.6","typescript":"^5.9.3","@types/node":"^25.1.0"},"_npmOperationalInternal":{"tmp":"tmp/brotli-lib_0.0.6_1770502910472_0.9858950220068472","host":"s3://npm-registry-packages-npm-production"}},"0.0.7":{"name":"brotli-lib","version":"0.0.7","description":"TypeScript Brotli encoder and decoder","type":"module","sideEffects":false,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./encode":{"types":"./dist/encode.d.ts","import":"./dist/encode.js","require":"./dist/encode.cjs"},"./decode":{"types":"./dist/decode.d.ts","import":"./dist/decode.js","require":"./dist/decode.cjs"}},"main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=12"},"scripts":{"build":"rolldown -c && tsc --emitDeclarationOnly --declaration --outDir dist","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run test && npm run build","test":"vitest run","test:watch":"vitest","bench":"vitest bench","bench:encode":"vitest bench bench/encode.bench.ts","bench:decode":"vitest bench bench/decode.bench.ts","typecheck":"tsc --noEmit"},"keywords":["brotli","encode","decode","compress","decompress","compression","typescript","tree-shaking"],"author":{"name":"Jeremy Tribby, Countertype LLC"},"license":"MIT","devDependencies":{"@types/node":"^25.1.0","brotli":"^1.3.3","rolldown":"^1.0.0-beta.6","typescript":"^5.9.3","vitest":"^4.0.18"},"_id":"brotli-lib@0.0.7","gitHead":"3d06ebb275200946386bef1068830f639872d2be","_nodeVersion":"22.14.0","_npmVersion":"11.2.0","dist":{"integrity":"sha512-ph4vAFd0gGa9nl94BeFLnjsWt3XfpRD6dPoUWPLrj3GO6qcx2pb7S/2O2zwxt2+a4Co5+cMBuPgj/N0zUo+pvw==","shasum":"7a9d1911b83c5a170c5bb5054974b8534d3bc278","tarball":"https://registry.npmjs.org/brotli-lib/-/brotli-lib-0.0.7.tgz","fileCount":74,"unpackedSize":1161411,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCDcBXa3AjqiVpgMhlJ1x6LC+OFO3E0wXfwgziwJBbfFAIgIB5W2g9aAaVSo6z9TN+fxOUVcd6g3Q+ileRkVOUv9D0="}]},"_npmUser":{"name":"tribby","email":"opensource@countertype.com"},"directories":{},"maintainers":[{"name":"tribby","email":"opensource@countertype.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/brotli-lib_0.0.7_1770873134153_0.8243211223182279"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-03T08:38:45.949Z","modified":"2026-02-12T05:12:14.427Z","0.0.1":"2026-02-03T08:38:46.188Z","0.0.2":"2026-02-03T11:34:49.549Z","0.0.3":"2026-02-04T03:10:07.867Z","0.0.4":"2026-02-06T22:53:25.688Z","0.0.6":"2026-02-07T22:21:50.712Z","0.0.7":"2026-02-12T05:12:14.313Z"},"author":{"name":"Jeremy Tribby, Countertype LLC"},"license":"MIT","keywords":["brotli","encode","decode","compress","decompress","compression","typescript","tree-shaking"],"description":"TypeScript Brotli encoder and decoder","maintainers":[{"name":"tribby","email":"opensource@countertype.com"}],"readme":"# brotli-lib\n\n[![npm version](https://img.shields.io/npm/v/brotli-lib)](https://www.npmjs.com/package/brotli-lib)\n\nTypeScript Brotli encoder and decoder\n\n## Install\n\n```bash\nnpm install brotli-lib\n```\n\n## Usage\n\n```typescript\nimport { brotliDecode } from 'brotli-lib/decode'\n\nconst decompressed = brotliDecode(compressed)\n```\n\n```typescript\nimport { brotliEncode } from 'brotli-lib/encode'\n\nconst compressed = brotliEncode(data, { quality: 11 })\n```\n\n```typescript\nimport { brotliEncode, brotliDecode } from 'brotli-lib'\n```\n\n## API\n\n### Decode\n\n```typescript\nfunction brotliDecode(\n  data: Uint8Array,\n  options?: { maxOutputSize?: number; customDictionary?: Uint8Array }\n): Uint8Array\n\nfunction brotliDecodedSize(data: Uint8Array): number  // -1 if multi-metablock\n```\n\n### Encode\n\n```typescript\nfunction brotliEncode(\n  data: Uint8Array,\n  options?: {\n    quality?: number   // 0-11, default 11\n    lgwin?: number     // window bits 10-24, default 22\n    mode?: EncoderMode // GENERIC, TEXT, or FONT\n  }\n): Uint8Array\n\nclass BrotliEncoder {\n  constructor(options?: BrotliEncodeOptions)\n  update(chunk: Uint8Array): void\n  finish(): Uint8Array\n}\n```\n\nFONT mode uses distance coding parameters optimized for transformed font data. It doesn't improve compression on raw TTF/OTF files - the gains come from WOFF2's font-specific transforms (glyf, loca, hmtx) applied before brotli compression\n\n## Performance\n\n### Decode\n\n|  | brotli-lib | brotli.js | Google decode.ts |\n|--|------------|-----------|---------------|\n| Speed (vs Google) | 1.2x | 0.5-0.6x | 1x |\n| Custom dictionary | yes | no | yes |\n| Compressed static dict | yes | yes | no |\n\nDecode times (Apple M2 Max, Node 22):\n\n| File | brotli-lib | brotli.js | Google decode.ts |\n|------|------------|-----------|---------------|\n| enc-ttf (305 KB) | 2.3 ms | 4.4 ms | 2.9 ms |\n| enc-otf (253 KB) | 2.2 ms | 4.3 ms | 2.8 ms |\n| enc-var-ttf (788 KB) | 5.8 ms | 11.6 ms | 7.0 ms |\n| noto-tc (7 MB) | 47 ms | 90 ms | 57 ms |\n\n2x faster than brotli.js, ~20% faster than Google's JS decoder\n\n### Encode\n\nEncoder vs Node.js native `zlib.brotliCompressSync` (quality 11):\n\n| Input | brotli-lib | node:zlib | vs native |\n|-------|-----------|-----------|-----------|\n| 13 B | 0.001 ms | 0.16 ms | 160x faster |\n| 4.5 KB | 0.27 ms | 0.33 ms | 1.2x faster |\n| 45 KB | 3.0 ms | 1.4 ms | 2x slower |\n\nMuch faster for tiny inputs (no native binding overhead), faster for medium, ~2x slower for large\n\nRun `npm run bench` to reproduce\n\n## Subpath exports\n\n| Import | Export size (gzip) |\n|--------|--------------------|\n| `brotli-lib/encode` | 25 KB |\n| `brotli-lib/decode` | 66 KB |\n| `brotli-lib` | 90 KB |\n\nThe 122 KB static dictionary is compressed to 52 KB and bootstrapped at runtime (à la Devon Govett's brotli.js).\n\n## License\n\nMIT\n\nDerived from Google's [brotli](https://github.com/google/brotli) (MIT)\n\nMaintained by [@jpt](https://github.com/jpt)\n","readmeFilename":"README.md"}