mirror of
https://github.com/affaan-m/ECC.git
synced 2026-11-23 00:05:27 +00:00
fix(transcripts): complete short reads within the requested tail
This commit is contained in:
1 parent
8abdf329ec
commit
5c7eeba436
2 files changed
+96
-1
No files matched your search
@@ -22,7 +22,12 @@ function readFileTail(filePath, tailBytes, options = {}) {
|
||||
}
|
||||
|
||||
const buffer = Buffer.alloc(length);
|
||||
const bytesRead = fs.readSync(fd, buffer, 0, length, start);
|
||||
let bytesRead = 0;
|
||||
while (bytesRead < length) {
|
||||
const count = fs.readSync(fd, buffer, bytesRead, length - bytesRead, start + bytesRead);
|
||||
if (count === 0) break;
|
||||
bytesRead += count;
|
||||
}
|
||||
return {
|
||||
text: buffer.toString('utf8', 0, bytesRead),
|
||||
truncated: start > 0,
|
||||
|
||||
Reference in new issue
Block a user