Browse Source

add .toAuto to replicate previous behavior

develop
Conduitry 1 year ago
parent
commit
25fe25ab71
3 changed files with 6 additions and 1 deletions
  1. +2
    -1
      README.md
  2. +1
    -0
      src/index.js
  3. +3
    -0
      src/toAuto.js

+ 2
- 1
README.md View File

@ -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
- 0
src/index.js View File

@ -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
- 0
src/toAuto.js View 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…
Cancel
Save