UNPKG

fast-extract

Version:

Extract contents from various archive types (tar, tar.bz2, tar.gz, tar.xz, tgz, zip)

23 lines (22 loc) 777 B
import worker from './worker.js'; export { default as createWriteStream } from './createWriteStream.js'; export * from './types.js'; export default function fastExtract(src, dest, options, callback) { if (options === undefined && typeof dest !== 'string') { callback = options; options = dest; dest = null; } if (typeof options === 'function') { callback = options; options = null; } if (typeof options === 'string') options = { type: options }; options = options || {}; if (typeof callback === 'function') return worker(src, dest, options, callback); return new Promise((resolve, reject)=>worker(src, dest, options, (err)=>{ err ? reject(err) : resolve(undefined); })); }