diff --git a/src/ssn/streams/readLocalFileHeader.ts b/src/ssn/streams/readLocalFileHeader.ts index b47530b..91c52f8 100644 --- a/src/ssn/streams/readLocalFileHeader.ts +++ b/src/ssn/streams/readLocalFileHeader.ts @@ -19,12 +19,15 @@ function waitReadableLength(inputStream: stream.Readable, minLength: number): Pr export default async function readLocalFileHeader(inputStream: stream.Readable): Promise { let localFileHeader: Buffer = inputStream.read(30); if (localFileHeader === null) { + console.log('Need to wait'); //need to wait until data is ready for reading await waitReadableLength(inputStream, 30); + console.log('Ready'); localFileHeader = inputStream.read(30); } //Local file header signature + console.log(localFileHeader); const magic = localFileHeader.readUInt32LE(0); if (magic !== 0x04034B50) { throw new Error(`Local file header had wrong magic; expected 0x04034B50 but got 0x${magic.toString(16).padStart(8, '0')}.`);