🚑 Fix local file header reading for arraybuffer-based streams
This commit is contained in:
parent
0c8bc4d732
commit
e84e5bd3d7
1 changed files with 6 additions and 3 deletions
|
@ -17,9 +17,12 @@ function waitReadableLength(inputStream: stream.Readable, minLength: number): Pr
|
||||||
* Returns length of the local file header.
|
* Returns length of the local file header.
|
||||||
*/
|
*/
|
||||||
export default async function readLocalFileHeader(inputStream: stream.Readable): Promise<number> {
|
export default async function readLocalFileHeader(inputStream: stream.Readable): Promise<number> {
|
||||||
//TODO: need to wait until
|
let localFileHeader: Buffer = inputStream.read(30);
|
||||||
|
if (localFileHeader === null) {
|
||||||
|
//need to wait until data is ready for reading
|
||||||
await waitReadableLength(inputStream, 30);
|
await waitReadableLength(inputStream, 30);
|
||||||
const localFileHeader: Buffer = inputStream.read(30);
|
localFileHeader = inputStream.read(30);
|
||||||
|
}
|
||||||
|
|
||||||
//Local file header signature
|
//Local file header signature
|
||||||
const magic = localFileHeader.readUInt32LE(0);
|
const magic = localFileHeader.readUInt32LE(0);
|
||||||
|
|
Loading…
Reference in a new issue