Skip to content

firien/minzip

Repository files navigation

MinZip

node test browser test

Minimalistic zip file generator using native APIs. Minified code is ~3kb.

Works in browsers (Chrome >80, Firefox >113, Safari >16.4) and node (> v18)

Required APIs

  • CompressionStream
  • ArrayBuffer
  • DataView
  • TextEncoder
  • Response
  • Blob

Example

import MinZip from 'minzip'
const zip = new MinZip()
const blob = new Blob(['hello world'], { type: 'text/plain' })
await zip.addFile('one.txt', blob)
const zipBlob = await zip.write()

Caveats

Very new and relatively untested. Files seem very straight forward, but the Folders are a little fuzzy at this point.

Resources