From 1a6d749bd534ca5b9a61b361ad42eab2f9ba3efa Mon Sep 17 00:00:00 2001 From: Tomohiro Ogoke Date: Tue, 21 May 2019 06:12:33 +0900 Subject: [PATCH] [jszip] Add `decodeFileName` option for JSZipLoadOptions interface (#35434) --- types/jszip/index.d.ts | 1 + types/jszip/jszip-tests.ts | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/types/jszip/index.d.ts b/types/jszip/index.d.ts index a5ab4ee8e1..5f8b4e4afc 100644 --- a/types/jszip/index.d.ts +++ b/types/jszip/index.d.ts @@ -132,6 +132,7 @@ declare namespace JSZip { checkCRC32?: boolean; optimizedBinaryString?: boolean; createFolders?: boolean; + decodeFileName?(filenameBytes: Uint8Array): string; } } diff --git a/types/jszip/jszip-tests.ts b/types/jszip/jszip-tests.ts index 2910b5f729..0ea8c9b790 100644 --- a/types/jszip/jszip-tests.ts +++ b/types/jszip/jszip-tests.ts @@ -44,7 +44,13 @@ function testJSZip() { const zip = createTestZip(); zip.generateAsync({compression: "DEFLATE", type: "base64"}).then((serializedZip) => { const newJszip = new JSZip(); - return newJszip.loadAsync(serializedZip, {base64: true/*, checkCRC32: true*/}); + return newJszip.loadAsync(serializedZip, { + base64: true, + checkCRC32: true, + optimizedBinaryString: true, + createFolders: true, + decodeFileName: filenameBytes => filenameBytes.toString() + }); }).then((newJszip: JSZip) => { newJszip.file("test.txt").async('text').then((text: string) => { if (text === "test string") {