🚧 Add some debugging info
This commit is contained in:
parent
74b312953d
commit
f284119bf1
1 changed files with 3 additions and 0 deletions
|
@ -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')}.`);
|
||||||
|
|
Loading…
Reference in a new issue