1
Fork 0
Do not zip. Just store. https://conduitry.dev/do-not-zip
Find a file
2018-11-07 06:27:13 -05:00
src switch to separate explicit functions for different kinds of output 2018-11-05 10:01:10 -05:00
test Adding tests for browser and node 2018-04-19 22:29:15 -04:00
.eslintrc.yaml docs and stuff 2018-04-19 12:25:25 -04:00
.gitignore Adding tests for browser and node 2018-04-19 22:29:15 -04:00
CHANGELOG.md v0.1.3 2018-09-25 22:10:01 -04:00
LICENSE docs and stuff 2018-04-19 12:25:25 -04:00
package.json update testing dependencies 2018-11-07 06:27:13 -05:00
README.md switch to separate explicit functions for different kinds of output 2018-11-05 10:01:10 -05:00
rollup.config.js switch to separate explicit functions for different kinds of output 2018-11-05 10:01:10 -05:00
rollup.config.test.js Adding tests for browser and node 2018-04-19 22:29:15 -04:00

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 Blog

Thanks

License

Copyright (c) 2018 Conduitry