🐛 getFile API

This commit is contained in:
frostime 2024-06-04 15:04:07 +08:00
parent 81d5bee160
commit 9c7572b820

View file

@ -6,7 +6,7 @@
* API [API_zh_CN.md](https://github.com/siyuan-note/siyuan/blob/master/API_zh_CN.md)
*/
import { fetchSyncPost, IWebSocketData } from "siyuan";
import { fetchPost, fetchSyncPost, IWebSocketData } from "siyuan";
export async function request(url: string, data: any) {
@ -328,12 +328,11 @@ export async function getFile(path: string): Promise<any> {
path: path
}
let url = '/api/file/getFile';
try {
let file = await fetchSyncPost(url, data);
return file;
} catch (error_msg) {
return null;
}
return new Promise((resolve, _) => {
fetchPost(url, data, (content: any) => {
resolve(content)
});
});
}
export async function putFile(path: string, isDir: boolean, file: any) {