🚧 Test enabling decompression again
This commit is contained in:
parent
d3fa6d7c29
commit
4d5e0d403a
4 changed files with 8 additions and 8 deletions
|
@ -10,7 +10,7 @@ import readBytesFromStream from './streams/readBytesFromStream';
|
|||
* The stream must already start at the .zip's local file header
|
||||
* and must transparently span across multiple disks if necessary.
|
||||
*/
|
||||
export default async function extractFileStream(file: ISsnFileEntry, inputStream: stream.Readable, skipDecompression: boolean = false): Promise<stream.Readable> {
|
||||
export default async function extractFileAsStream(file: ISsnFileEntry, inputStream: stream.Readable, skipDecompression: boolean = false): Promise<stream.Readable> {
|
||||
let curStream = inputStream;
|
||||
|
||||
//pipe into decryption if file is encrypted
|
|
@ -2,7 +2,7 @@ import * as xmlJs from 'xml-js';
|
|||
import getUrlContents from '../cdn/getUrlContents';
|
||||
import IManifest from '../interfaces/IManifest';
|
||||
import { Product } from '../interfaces/ISettings';
|
||||
import extractFileStream from './extractFileStream';
|
||||
import extractFileAsStream from './extractFileAsStream';
|
||||
import parsePatchmanifest from './reader/parsePatchmanifest';
|
||||
import readSsnFile from './reader/readSsnFile';
|
||||
import arrayBufferToStream from './streams/arrayBufferToStream';
|
||||
|
@ -37,7 +37,7 @@ export default async function getManifest(product: Product): Promise<IManifest>
|
|||
|
||||
//Extract manifest.xml file
|
||||
await readLocalFileHeader(stream, true);
|
||||
const patchmanifestStream = await extractFileStream(firstFile, stream);
|
||||
const patchmanifestStream = await extractFileAsStream(firstFile, stream);
|
||||
|
||||
//Convert ArrayBuffer to string
|
||||
const patchmanifestXml = await streamToString(patchmanifestStream);
|
||||
|
|
|
@ -2,7 +2,7 @@ import downloadUrlContents from '../cdn/downloadUrlContents';
|
|||
import getUrlContents from '../cdn/getUrlContents';
|
||||
import { Product } from '../interfaces/ISettings';
|
||||
import { SsnDiffType } from '../interfaces/ISsnFileEntry';
|
||||
import extractFileStream from './extractFileStream';
|
||||
import extractFileAsStream from './extractFileAsStream';
|
||||
import getSolidpkg from './getSolidpkg';
|
||||
import readSsnFile from './reader/readSsnFile';
|
||||
import getFileFromDisks from './streams/getFileFromDisks';
|
||||
|
@ -40,7 +40,7 @@ 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 extractFileStream(file, fileStream, true);
|
||||
const fileContents = await extractFileAsStream(file, fileStream);
|
||||
console.debug(file.name, file.compressedSize, await streamToArrayBuffer(fileContents));
|
||||
//TODO: need to write to disk
|
||||
} catch (error) {
|
||||
|
@ -52,7 +52,7 @@ 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 extractFileStream(file, fileStream, true);
|
||||
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) {
|
||||
|
|
|
@ -2,7 +2,7 @@ import getUrlContents from '../cdn/getUrlContents';
|
|||
import { Product } from '../interfaces/ISettings';
|
||||
import ISolid from '../interfaces/ISolidFile';
|
||||
import ISolidSimple from '../interfaces/ISolidSimple';
|
||||
import extractFileStream from './extractFileStream';
|
||||
import extractFileAsStream from './extractFileAsStream';
|
||||
import parseBencode from './reader/bencodeParser';
|
||||
import readSsnFile from './reader/readSsnFile';
|
||||
import arrayBufferToStream from './streams/arrayBufferToStream';
|
||||
|
@ -42,7 +42,7 @@ export default async function getSolidpkg(product: Product, from: number, to: nu
|
|||
|
||||
//Extract metafile.solid file
|
||||
await readLocalFileHeader(stream, true);
|
||||
const solidFileStream = await extractFileStream(firstFile, stream);
|
||||
const solidFileStream = await extractFileAsStream(firstFile, stream);
|
||||
const solidFileArrayBuffer = await streamToArrayBuffer(solidFileStream);
|
||||
const solidContents = parseBencode(solidFileArrayBuffer) as ISolid;
|
||||
|
||||
|
|
Loading…
Reference in a new issue