UNPKG

fast-extract

Version:

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

1 lines 1.43 kB
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/fast-extract/src/worker.mjs"],"sourcesContent":["import once from 'call-once-fn';\nimport oo from 'on-one';\n\nimport createWriteStream from './createWriteStream.mjs';\n\nexport default function extract(source, dest, options, callback) {\n if (typeof options === 'string') options = { type: options };\n options = { source: source, ...options };\n const res = createWriteStream(dest, options);\n\n // path\n if (typeof source === 'string') {\n const end = once(callback);\n res.on('error', end);\n res.write(source, 'utf8');\n return res.end(end);\n }\n\n // stream\n const stream = source.pipe(res);\n oo(stream, ['error', 'end', 'close', 'finish'], callback);\n}\n"],"names":["extract","source","dest","options","callback","type","res","createWriteStream","end","once","on","write","stream","pipe","oo"],"mappings":";;;;+BAKA;;;eAAwBA;;;iEALP;4DACF;wEAEe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEf,SAASA,QAAQC,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC7D,IAAI,OAAOD,YAAY,UAAUA,UAAU;QAAEE,MAAMF;IAAQ;IAC3DA,UAAU;QAAEF,QAAQA;OAAWE;IAC/B,IAAMG,MAAMC,IAAAA,0BAAiB,EAACL,MAAMC;IAEpC,OAAO;IACP,IAAI,OAAOF,WAAW,UAAU;QAC9B,IAAMO,MAAMC,IAAAA,mBAAI,EAACL;QACjBE,IAAII,EAAE,CAAC,SAASF;QAChBF,IAAIK,KAAK,CAACV,QAAQ;QAClB,OAAOK,IAAIE,GAAG,CAACA;IACjB;IAEA,SAAS;IACT,IAAMI,SAASX,OAAOY,IAAI,CAACP;IAC3BQ,IAAAA,cAAE,EAACF,QAAQ;QAAC;QAAS;QAAO;QAAS;KAAS,EAAER;AAClD"}