1.0.2 • Published 4 years ago

mscabinet v1.0.2

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
4 years ago

node-mscabinet

Example

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");
    });