Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

do-not-zip

Conduitry181.4kMIT1.0.0TypeScript support: definitely-typed

Do not zip. Just store.

browser, zip, archive

readme

do-not-zip

npm version

Do not zip. Just store.

What

Stick some text files into a zip file. This library is super simple and small because it just stores the files without compressing them, which is often sufficient when all you want to do is let the user download some files generated in the browser. Works on the server (Node.js) and on the client (JavaScript). Requires ES2015+.

How

import * as doNotZip from 'do-not-zip';
const output = doNotZip.toArray([
    { path: 'path/to/file1.txt', data: 'Hello' },
    { path: 'another/file2.txt', data: 'World' },
    { path: 'yet/another/file3.bin', data: [1, 2, 3, 4, 5] },
]);
// => output will be an array of bytes
// use .toBuffer on the server to generate a Buffer, and use .toBlob on the client to generate a Blob
// use .toAuto to generate a Buffer on the server or a Blob on the client

Thanks

License

Copyright (c) 2018 Conduitry

changelog

v1.0.0

  • Rename current (default and only) export to a named toAuto export, which creates a Blob or Buffer as appropriate
  • Add toArray, toBlob, and toBuffer exports to manually specify the output format
  • Git tag is now the built version, for easier direct installation without the npm registry

v0.1.3

  • Fix issue when trying to add large files

v0.1.2

  • Support specifying files as arrays of bytes

v0.1.1

  • Prefer outputting as a Blob over a Buffer, as it's possible that Buffer will have been polyfilled in the browser

v0.1.0

  • Initial release