From 21f7662a770d93201ae4a8fca3bc365b7542ae7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20=C5=9Awi=C4=99s?= Date: Wed, 17 Aug 2022 18:52:19 +0200 Subject: [PATCH] Add toString to Packer --- src/export/packer/packer.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/export/packer/packer.ts b/src/export/packer/packer.ts index 56d604fe18..4d047f7381 100644 --- a/src/export/packer/packer.ts +++ b/src/export/packer/packer.ts @@ -13,6 +13,17 @@ export enum PrettifyType { } export class Packer { + public static async toString(file: File, prettify?: boolean | PrettifyType): Promise { + const zip = this.compiler.compile(file, prettify); + const zipData = await zip.generateAsync({ + type: "string", + mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + compression: "DEFLATE", + }); + + return zipData; + } + public static async toBuffer(file: File, prettify?: boolean | PrettifyType): Promise { const zip = this.compiler.compile(file, prettify); const zipData = await zip.generateAsync({