add .toAuto to replicate previous behavior

This commit is contained in:
Conduitry 2018-11-07 06:42:10 -05:00
bovenliggende c82a037f97
commit 25fe25ab71
3 gewijzigde bestanden met toevoegingen van 6 en 1 verwijderingen

Bestand weergeven

@ -18,7 +18,8 @@ const output = doNotZip.toArray([
{ 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
// 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

Bestand weergeven

@ -1,3 +1,4 @@
export { default as toArray } from './toArray.js';
export { default as toAuto } from './toAuto.js';
export { default as toBlob } from './toBlob.js';
export { default as toBuffer } from './toBuffer.js';

3
src/toAuto.js Normal file
Bestand weergeven

@ -0,0 +1,3 @@
import toBlob from './toBlob.js';
import toBuffer from './toBuffer.js';
export default files => (typeof Blob === 'undefined' ? toBuffer : toBlob)(files);