diff --git a/src/ssn/extractFileStream.ts b/src/ssn/extractFileAsStream.ts similarity index 88% rename from src/ssn/extractFileStream.ts rename to src/ssn/extractFileAsStream.ts index ad68e7d..1732c30 100644 --- a/src/ssn/extractFileStream.ts +++ b/src/ssn/extractFileAsStream.ts @@ -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 { +export default async function extractFileAsStream(file: ISsnFileEntry, inputStream: stream.Readable, skipDecompression: boolean = false): Promise { let curStream = inputStream; //pipe into decryption if file is encrypted diff --git a/src/ssn/getManifest.ts b/src/ssn/getManifest.ts index 9ab409d..b11e2e2 100644 --- a/src/ssn/getManifest.ts +++ b/src/ssn/getManifest.ts @@ -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 //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); diff --git a/src/ssn/getPatch.ts b/src/ssn/getPatch.ts index 7a2ba19..46178f6 100644 --- a/src/ssn/getPatch.ts +++ b/src/ssn/getPatch.ts @@ -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) { diff --git a/src/ssn/getSolidpkg.ts b/src/ssn/getSolidpkg.ts index 3b4cea8..be865da 100644 --- a/src/ssn/getSolidpkg.ts +++ b/src/ssn/getSolidpkg.ts @@ -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;