You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
All: Improved file and memory drivers to make it easier to use same sync method for all the drivers
This commit is contained in:
@@ -151,12 +151,6 @@ class FileApiDriverLocal {
|
||||
} else {
|
||||
output = await fs.readFile(path, options.encoding);
|
||||
}
|
||||
|
||||
// if (options.encoding == 'binary') {
|
||||
// output = await fs.readFile(path);
|
||||
// } else {
|
||||
// output = await fs.readFile(path, options.encoding);
|
||||
// }
|
||||
} catch (error) {
|
||||
if (error.code == 'ENOENT') return null;
|
||||
throw this.fsErrorToJsError_(error);
|
||||
@@ -184,7 +178,11 @@ class FileApiDriverLocal {
|
||||
});
|
||||
}
|
||||
|
||||
put(path, content) {
|
||||
async put(path, content, options = null) {
|
||||
if (!options) options = {};
|
||||
|
||||
if (options.source === 'file') content = await fs.readFile(options.path);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.writeFile(path, content, function(error) {
|
||||
if (error) {
|
||||
|
||||
Reference in New Issue
Block a user