🚧 Add some debugging info

This commit is contained in:
C-3PO 2018-07-05 23:48:25 +02:00
parent 74b312953d
commit f284119bf1
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

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