🐛 Found error why .read() returns null; need to wait for readable event
This commit is contained in:
parent
6d6c673556
commit
89d1b9e644
2 changed files with 2 additions and 1 deletions
|
@ -58,7 +58,7 @@ export default function saveResponse(
|
|||
//TODO: need to automatically delete file once it is no longer used
|
||||
//TODO: need to provide methods to seek through file
|
||||
return resolve(tempFileName);
|
||||
//const stream = fs.createReadStream(tempFileName, { encoding: 'binary' }); //TODO: we may need to remove encoding since mentioning encoding automatically switches to string format
|
||||
//const stream = fs.createReadStream(tempFileName);
|
||||
//return resolve(stream);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ export default function getFileFromDisks(disks: string[], { diskStart, offset, s
|
|||
if (chunk === null) {
|
||||
curDiskIndex += 1;
|
||||
curDisk = getStream(disks, curDiskIndex, 0);
|
||||
//await new Promise((resolve) => { curDisk.on('readable', () => { resolve(); }); });
|
||||
return curDisk.read(num);
|
||||
} else {
|
||||
return chunk;
|
||||
|
|
Loading…
Reference in a new issue