UNPKG

mscabinet

Version:

```javascript import { Extract, CFFile } from 'cabinet'; import * as path from 'path'; import * as fs from 'fs';

25 lines (21 loc) 656 B
# node-mscabinet ## Example ```javascript import { Extract, CFFile } from 'cabinet'; import * as path from 'path'; import * as fs from 'fs'; const extract = new Extract(); const dist = './dist'; fs.createReadStream('input.cab').pipe(extract) .on('entry', (file: CFFile, stream, next) => { const target = path.resolve(dist, '.' + file.name); const dirname = path.dirname(target); fs.mkdirSync(dirname, {recursive: true}); stream .on('finish', () => next()) .pipe(fs.createWriteStream(target)); }) .on('close', () => { console.log("ONCLOSE"); }); ```