2016-05-26 15:08:34 +01:00
|
|
|
import * as fs from "fs";
|
2017-03-08 21:54:52 +00:00
|
|
|
import { Document } from "../../docx/document";
|
|
|
|
import { Numbering } from "../../numbering";
|
|
|
|
import { Properties } from "../../properties";
|
2017-03-09 23:32:52 +00:00
|
|
|
import { Styles } from "../../styles";
|
2017-03-08 21:54:52 +00:00
|
|
|
import { Packer } from "./packer";
|
|
|
|
|
2016-03-31 18:03:16 +01:00
|
|
|
export class LocalPacker extends Packer {
|
2016-05-26 15:08:34 +01:00
|
|
|
private stream: fs.WriteStream;
|
|
|
|
|
2017-03-09 23:32:52 +00:00
|
|
|
constructor(document: Document, styles?: Styles, properties?: Properties, numbering?: Numbering) {
|
2016-07-04 18:47:13 +01:00
|
|
|
super(document, styles, properties, numbering);
|
2016-03-31 18:03:16 +01:00
|
|
|
}
|
2016-05-26 15:08:34 +01:00
|
|
|
|
2017-03-08 21:54:52 +00:00
|
|
|
public pack(path: string): void {
|
2017-03-12 21:43:52 +00:00
|
|
|
path = path.replace(/.docx$/, "");
|
2017-03-12 21:34:49 +00:00
|
|
|
this.stream = fs.createWriteStream(`${path}.docx`);
|
2016-05-26 15:08:34 +01:00
|
|
|
super.pack(this.stream);
|
|
|
|
}
|
2017-03-08 21:54:52 +00:00
|
|
|
}
|