UNPKG

fast-extract

Version:

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

16 lines (15 loc) 699 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) { callback = typeof options === 'function' ? options : callback; options = typeof options === 'function' ? dest || {} : typeof options === 'string' ? { type: options } : options || {}; options = typeof dest === 'string' ? options : { ...options, type: dest }; if (typeof callback === 'function') return worker(src, dest, options, callback); return new Promise((resolve, reject)=>worker(src, dest, options, (err)=>err ? reject(err) : resolve())); }