diff --git a/src/ssn/extractFileAsStream.ts b/src/ssn/extractFileAsStream.ts index 6e8d1bb..6bab925 100644 --- a/src/ssn/extractFileAsStream.ts +++ b/src/ssn/extractFileAsStream.ts @@ -22,11 +22,6 @@ export default async function extractFileAsStream(file: ISsnFileEntry, inputStre await readBytesFromStream(curStream, 12); } - if (skipDecompression) { - const fileStream = fs.createWriteStream(`/tmp/patcher/${file.name}`); - curStream.pipe(fileStream); - } - if (!skipDecompression) { //pipe into decompression const decompressTransform = zlib.createInflateRaw(); diff --git a/src/ssn/getPatch.ts b/src/ssn/getPatch.ts index b535283..1158798 100644 --- a/src/ssn/getPatch.ts +++ b/src/ssn/getPatch.ts @@ -39,8 +39,8 @@ export default async function getPatch(product: Product, from: number, to: numbe fileEntries.filter((file) => file.diffType === SsnDiffType.NewFile).forEach(async (file) => { try { const fileStream = await getFileFromDisks(diskFilenames, { diskStart: file.diskNumberStart, offset: file.offset, length: file.compressedSize }); - const fileContents = await extractFileAsStream(file, fileStream, true); - console.debug(file.name, file.compressedSize); //, await streamToArrayBuffer(fileContents)); + const fileContents = await extractFileAsStream(file, fileStream); + console.debug(file.name, file.compressedSize, await streamToArrayBuffer(fileContents)); //TODO: need to write to disk } catch (error) { console.error(`Could not extract file "${file.name}"`, error); @@ -51,8 +51,8 @@ export default async function getPatch(product: Product, from: number, to: numbe fileEntries.filter((file) => file.diffType === SsnDiffType.Changed).forEach(async (file) => { try { const fileStream = await getFileFromDisks(diskFilenames, { diskStart: file.diskNumberStart, offset: file.offset, length: file.compressedSize }); - const fileContents = await extractFileAsStream(file, fileStream, true); - console.debug(file.name, file.compressedSize); //, await streamToArrayBuffer(fileContents)); + const fileContents = await extractFileAsStream(file, fileStream); + console.debug(file.name, file.compressedSize, await streamToArrayBuffer(fileContents)); //TODO: need to apply diffing, then write to disk } catch (error) { console.error(`Could not extract file "${file.name}"`, error);