* Returns the compressed data for this archive in a buffer. _This method will * not wait for any outstanding #addFile add * #addDir operations before encoding the archive._ * * @param {string} compression The desired compression. * Must be `STORE` (the default) or
(compression = 'STORE')
| 131 | * as a buffer. |
| 132 | */ |
| 133 | toBuffer(compression = 'STORE') { |
| 134 | if (compression !== 'STORE' && compression !== 'DEFLATE') { |
| 135 | return Promise.reject(new InvalidArgumentError(`compression must be one of {STORE, DEFLATE}, got ${compression}`)) |
| 136 | } |
| 137 | return Promise.resolve(this.z_.generateAsync({ compression, type: 'nodebuffer' })) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | /** |
no test coverage detected