fix: race condition

Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
Andrew Calcutt 2023-10-08 15:53:16 -04:00
parent a9b5db234f
commit 553f58271e

View file

@ -137,8 +137,8 @@ function ArrayBufferToBuffer(ab) {
const ReadBytes = async (filePath, offset, size) => { const ReadBytes = async (filePath, offset, size) => {
const sharedBuffer = Buffer.alloc(size); const sharedBuffer = Buffer.alloc(size);
const stats = fs.statSync(filePath); // file details
const fd = fs.openSync(filePath); // file descriptor const fd = fs.openSync(filePath); // file descriptor
const stats = fs.fstatSync(fd); // file details
let bytesRead = 0; // how many bytes were read let bytesRead = 0; // how many bytes were read
for (let i = 0; i < size; i++) { for (let i = 0; i < size; i++) {