mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
All: Fixed reading file by chuncks
This commit is contained in:
parent
1891eb4998
commit
d13c2cf8d7
@ -46,8 +46,9 @@ class FsDriverNode {
|
||||
|
||||
async readFileChunk(handle, length, encoding = 'base64') {
|
||||
let buffer = new Buffer(length);
|
||||
const result = await fs.read(handle, buffer, 0, length, null)
|
||||
const result = await fs.read(handle, buffer, 0, length, null);
|
||||
if (!result.bytesRead) return null;
|
||||
buffer = buffer.slice(0, result.bytesRead);
|
||||
if (encoding === 'base64') return buffer.toString('base64');
|
||||
if (encoding === 'ascii') return buffer.toString('ascii');
|
||||
throw new Error('Unsupported encoding: ' + encoding);
|
||||
|
Loading…
Reference in New Issue
Block a user