[jszip] Add decodeFileName option for JSZipLoadOptions interface (#35434)

This commit is contained in:
Tomohiro Ogoke 2019-05-21 06:12:33 +09:00 committed by Ryan Cavanaugh
parent bf6a6c6395
commit 1a6d749bd5
2 changed files with 8 additions and 1 deletions

View File

@ -132,6 +132,7 @@ declare namespace JSZip {
checkCRC32?: boolean;
optimizedBinaryString?: boolean;
createFolders?: boolean;
decodeFileName?(filenameBytes: Uint8Array): string;
}
}

View File

@ -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") {