2016-03-31 18:07:22 +01:00
|
|
|
import * as archiver from "archiver";
|
2016-03-31 18:03:16 +01:00
|
|
|
import * as fs from 'fs';
|
2016-03-31 15:49:42 +01:00
|
|
|
|
2016-03-31 15:45:48 +01:00
|
|
|
export class Packer {
|
2016-03-31 18:07:22 +01:00
|
|
|
protected archive: any;
|
2016-03-31 18:03:16 +01:00
|
|
|
|
|
|
|
constructor() {
|
2016-03-31 18:07:22 +01:00
|
|
|
this.archive = archiver.create("zip", {});
|
2016-03-31 18:03:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pack(output: fs.WriteStream): void {
|
|
|
|
this.archive.pipe(output);
|
|
|
|
|
|
|
|
this.archive.bulk([
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: __dirname + '/template',
|
|
|
|
src: ['**', '**/.rels']
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
}
|
2016-03-31 15:45:48 +01:00
|
|
|
}
|