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

Api: Added method to get notes

This commit is contained in:
Laurent Cozic
2018-09-27 18:35:10 +00:00
parent 8a619e4b8b
commit ef711af5b5
7 changed files with 322 additions and 79 deletions

View File

@ -26,7 +26,8 @@ class FsDriverNode extends FsDriverBase {
async writeBinaryFile(path, content) {
try {
let buffer = new Buffer(content);
// let buffer = new Buffer(content);
let buffer = Buffer.from(content);
return await fs.writeFile(path, buffer);
} catch (error) {
throw this.fsErrorToJsError_(error, path);
@ -173,7 +174,8 @@ class FsDriverNode extends FsDriverBase {
}
async readFileChunk(handle, length, encoding = 'base64') {
let buffer = new Buffer(length);
//let buffer = new Buffer(length);
let buffer = Buffer.alloc(length);
const result = await fs.read(handle, buffer, 0, length, null);
if (!result.bytesRead) return null;
buffer = buffer.slice(0, result.bytesRead);