add .toAuto to replicate previous behavior

This commit is contained in:
Conduitry 2018-11-07 06:42:10 -05:00
부모 c82a037f97
커밋 25fe25ab71
3개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제

파일 보기

@ -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

파일 보기

@ -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
파일 보기

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