add .toAuto to replicate previous behavior
This commit is contained in:
parent
c82a037f97
commit
25fe25ab71
@ -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
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);
|
Loading…
Reference in New Issue
Block a user