diff --git a/ts/export/packer/local.ts b/ts/export/packer/local.ts
index e69de29bb2..af9b0775e6 100644
--- a/ts/export/packer/local.ts
+++ b/ts/export/packer/local.ts
@@ -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);
+ }
+}
\ No newline at end of file
diff --git a/ts/export/packer/packer.ts b/ts/export/packer/packer.ts
index 33f47726df..852059440f 100644
--- a/ts/export/packer/packer.ts
+++ b/ts/export/packer/packer.ts
@@ -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']
+ }
+ ]);
+ }
}
\ No newline at end of file
diff --git a/ts/tests/formatterTest.ts b/ts/tests/formatterTest.ts
index 46a6e4ec42..829bf2fe8b 100644
--- a/ts/tests/formatterTest.ts
+++ b/ts/tests/formatterTest.ts
@@ -11,7 +11,7 @@ function jsonify(obj: Object) {
return JSON.parse(stringifiedJson);
}
-describe.only('Formatter', () => {
+describe('Formatter', () => {
var formatter: Formatter;
beforeEach(() => {
diff --git a/ts/tests/localPackerTest.ts b/ts/tests/localPackerTest.ts
new file mode 100644
index 0000000000..5b95064ac8
--- /dev/null
+++ b/ts/tests/localPackerTest.ts
@@ -0,0 +1,19 @@
+///
+///
+import {LocalPacker} from "../export/packer/local";
+import {assert} from "chai";
+
+describe.only('Packer', () => {
+ var packer: LocalPacker;
+
+ beforeEach(() => {
+ packer = new LocalPacker("test.zip");
+ });
+
+ describe('#pack()', () => {
+
+ it("should create a standard docx file", () => {
+ packer.pack();
+ });
+ });
+});
\ No newline at end of file
diff --git a/ts/typings/archiver/archiver.d.ts b/ts/typings/archiver/archiver.d.ts
index d5133555a4..b97c0fc0e5 100644
--- a/ts/typings/archiver/archiver.d.ts
+++ b/ts/typings/archiver/archiver.d.ts
@@ -22,21 +22,20 @@ declare module "archiver" {
name?: string;
}
- interface Archiver extends STREAM.Transform {
+ export interface Zip extends STREAM.Transform {
pipe(writeStream: FS.WriteStream): void;
append(readStream: FS.ReadStream, name: nameInterface): void;
finalize(): void;
+ bulk(mappings: any): void;
}
interface Options {
}
- function archiver(format: string, options?: Options): Archiver;
+ function archiver(format: string, options?: Options): Zip;
- namespace archiver {
- function create(format: string, options?: Options): Archiver;
+ export namespace archiver {
+ function create(format: string, options?: Options): Zip;
}
-
- export = archiver;
}