You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
All: Added uploadBlob method to Node apps
This commit is contained in:
@@ -156,6 +156,16 @@ function shimInit() {
|
||||
|
||||
return shim.fetchWithRetry(doFetchOperation, options);
|
||||
}
|
||||
|
||||
shim.uploadBlob = async function(url, options) {
|
||||
if (!options || !options.path) throw new Error('uploadBlob: source file path is missing');
|
||||
const content = await fs.readFile(options.path);
|
||||
options = Object.assign({}, options, {
|
||||
body: content,
|
||||
});
|
||||
return shim.fetch(url, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = { shimInit };
|
||||
Reference in New Issue
Block a user