1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

All: Refactored REST API to make it testable and to allow further extension

This commit is contained in:
Laurent Cozic
2018-09-27 09:14:05 +01:00
parent bc09d2c640
commit 8a619e4b8b
8 changed files with 1208 additions and 316 deletions

View File

@@ -186,7 +186,11 @@ function shimInit() {
const mime = mimeUtils.fromDataUrl(imageDataUrl);
await shim.writeImageToFile(image, mime, filePath);
} else {
throw new Error('Node support not implemented');
if (options.cropRect) throw new Error('Crop rect not supported in Node');
const imageDataURI = require('image-data-uri');
const result = imageDataURI.decode(imageDataUrl);
await shim.fsDriver().writeFile(filePath, result.dataBuffer, 'buffer');
}
}