Do not zip. Just store. https://cndtr.dev/do-not-zip
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
Conduitry 675ea5efe5 update readme 1 ano atrás
src add .toAuto to replicate previous behavior 1 ano atrás
test fix and update tests 1 ano atrás
.eslintrc.yaml docs and stuff 2 anos atrás
.gitignore update .gitignore for pnpm v3 1 ano atrás
CHANGELOG.md v1.0.0 1 ano atrás
LICENSE docs and stuff 2 anos atrás
README.md update readme 1 ano atrás
package.json v1.0.0 1 ano atrás
rollup.config.js switch to separate explicit functions for different kinds of output 1 ano atrás
rollup.config.test.js Adding tests for browser and node 2 anos atrás

README.md

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';

// on the server or the client:
const byteArray = doNotZip.toArray([
	// each file should have:
	// - 'path' - a string
	// - 'data' - a string, or an array of bytes or Uint8Array or Buffer or anything else that gives integers when indexed
	{ 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

// on the server:
const buffer = doNotZip.toBuffer([ ... ]);
// => output will be a Buffer

// on the client:
const blob = doNotZip.toBlob([ ... ]);
// => output will be a Blob

// on the server or the client:
const bufferOrBlob = doNotZip.toAuto([ ... ]);
// => output will be a Buffer on the server and a Blob on the client
// (which one to return is determined by whether there is a Blob global defined)

Thanks

License

MIT