diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/index.d.ts | 5 | ||||
| -rw-r--r-- | lib/index.js | 9 | ||||
| -rw-r--r-- | lib/zipfile.js | 6 |
3 files changed, 13 insertions, 7 deletions
diff --git a/lib/index.d.ts b/lib/index.d.ts index c73eeb5..705606f 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -1,7 +1,10 @@ interface Mammoth { convertToHtml: (input: Input, options?: Options) => Promise<Result>; extractRawText: (input: Input) => Promise<Result>; - embedStyleMap: (input: Input, styleMap: string) => Promise<{toBuffer: () => Buffer}>; + embedStyleMap: (input: Input, styleMap: string) => Promise<{ + toArrayBuffer: () => ArrayBuffer, + toBuffer: () => Buffer, + }>; images: Images; } diff --git a/lib/index.js b/lib/index.js index ac9f634..03302c2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -92,12 +92,15 @@ function embedStyleMap(input, styleMap) { return docxStyleMap.writeStyleMap(docxFile, styleMap); }) .then(function(docxFile) { - return docxFile.toBuffer(); + return docxFile.toArrayBuffer(); }) - .then(function(buffer) { + .then(function(arrayBuffer) { return { + toArrayBuffer: function() { + return arrayBuffer; + }, toBuffer: function() { - return buffer; + return Buffer.from(arrayBuffer); } }; }); diff --git a/lib/zipfile.js b/lib/zipfile.js index 85dde81..2129193 100644 --- a/lib/zipfile.js +++ b/lib/zipfile.js @@ -28,15 +28,15 @@ function openArrayBuffer(arrayBuffer) { zipFile.file(name, contents); } - function toBuffer() { - return zipFile.generateAsync({type: "nodebuffer"}); + function toArrayBuffer() { + return zipFile.generateAsync({type: "arraybuffer"}); } return { exists: exists, read: read, write: write, - toBuffer: toBuffer + toArrayBuffer: toArrayBuffer }; }); } |
