1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-06 02:39:55 +02:00

Fix issue #19: Support data descriptors in unzip.

This commit is contained in:
codedread 2020-04-30 23:54:21 -07:00
parent 97fcf8d630
commit 2db5b3b906
6 changed files with 123 additions and 54 deletions

View file

@ -11,6 +11,7 @@ import { assertEquals, runTests } from './muther.js';
const testInputs = {
'testUnzipDeflate': 'archive-testfiles/test-unzip-deflate.json',
'testUnzipDescriptor': 'archive-testfiles/test-unzip-descriptor.json',
'testUnzipStore': 'archive-testfiles/test-unzip-store.json',
'testUnrarM1': 'archive-testfiles/test-unrar-m1.json',
'testUnrarM2': 'archive-testfiles/test-unrar-m2.json',
@ -23,6 +24,9 @@ const testInputs = {
'testUntar': 'archive-testfiles/test-untar-1.json',
};
// TODO: It is an error for the Unarchiver worker not to terminate or send a FINISH event.
// We need to be able to test that here.
const testSuite = { tests: {} };
for (let testName in testInputs) {
const testInputFilename = testInputs[testName];
@ -37,7 +41,9 @@ for (let testName in testInputs) {
atob(testFile.archivedFile).split(',').map(str => parseInt(str)));
const unarchivedFile = new Uint8Array(
atob(testFile.unarchivedFile).split(',').map(str => parseInt(str)));
const unarchiver = getUnarchiver(archivedFile.buffer, '../');
const unarchiver = getUnarchiver(archivedFile.buffer, {
pathToBitJS: '../',
});
unarchiver.addEventListener(UnarchiveEventType.EXTRACT, evt => {
const theUnarchivedFile = evt.unarchivedFile.fileData;
try {