work on archiver
This commit is contained in:
@ -0,0 +1,15 @@
|
||||
import {Packer} from "./packer";
|
||||
import * as fs from 'fs';
|
||||
|
||||
export class LocalPacker extends Packer {
|
||||
private stream: fs.WriteStream
|
||||
|
||||
constructor(path: string) {
|
||||
super();
|
||||
this.stream = fs.createWriteStream(path);
|
||||
}
|
||||
|
||||
pack() {
|
||||
super.pack(this.stream);
|
||||
}
|
||||
}
|
@ -1,5 +1,22 @@
|
||||
import * as archiver from "archiver";
|
||||
import {archiver, Zip} from "archiver";
|
||||
import * as fs from 'fs';
|
||||
|
||||
export class Packer {
|
||||
|
||||
protected archive: Zip;
|
||||
|
||||
constructor() {
|
||||
this.archive = archiver.create("fgf", {});
|
||||
}
|
||||
|
||||
pack(output: fs.WriteStream): void {
|
||||
this.archive.pipe(output);
|
||||
|
||||
this.archive.bulk([
|
||||
{
|
||||
expand: true,
|
||||
cwd: __dirname + '/template',
|
||||
src: ['**', '**/.rels']
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user