🚧 Add debug output

This commit is contained in:
C-3PO 2018-07-08 22:02:27 +02:00
parent ab1280d46c
commit 09fb2eed85
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -15,10 +15,12 @@ function waitReadableLength(inputStream: stream.Readable, minLength: number): Pr
/** Reads the given number of bytes from the stream and returns them as a buffer, optionally waiting until the bytes are ready for reading. */
export default async function readBytesFromStream(inputStream: stream.Readable, length: number): Promise<Buffer> {
let localFileHeader: Buffer = inputStream.read(length);
console.log(localFileHeader);
while (localFileHeader === null) {
//need to wait until data is ready for reading
await waitReadableLength(inputStream, length);
localFileHeader = inputStream.read(length);
console.log(localFileHeader);
}
return localFileHeader;
}