1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

All: Fixed various issues regarding encryption and decryptino of resources, and started doing GUI for Electron app

This commit is contained in:
Laurent Cozic
2017-12-21 20:06:08 +01:00
parent 7750b954fc
commit 6683da804b
12 changed files with 81 additions and 89 deletions

View File

@ -46,11 +46,10 @@ class FsDriverNode {
async readFileChunk(handle, length, encoding = 'base64') {
let buffer = new Buffer(length);
const bytesRead = await fs.read(handle, buffer, 0, length, null)
if (!bytesRead) return null;
const output = buffer.slice(0, bytesRead);
if (encoding === 'base64') return output.toString('base64');
if (encoding === 'ascii') return output.toString('ascii');
const result = await fs.read(handle, buffer, 0, length, null)
if (!result.bytesRead) return null;
if (encoding === 'base64') return buffer.toString('base64');
if (encoding === 'ascii') return buffer.toString('ascii');
throw new Error('Unsupported encoding: ' + encoding);
}