🐛 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) * 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) { export async function request(url: string, data: any) {
@ -328,12 +328,11 @@ export async function getFile(path: string): Promise<any> {
path: path path: path
} }
let url = '/api/file/getFile'; let url = '/api/file/getFile';
try { return new Promise((resolve, _) => {
let file = await fetchSyncPost(url, data); fetchPost(url, data, (content: any) => {
return file; resolve(content)
} catch (error_msg) { });
return null; });
}
} }
export async function putFile(path: string, isDir: boolean, file: any) { export async function putFile(path: string, isDir: boolean, file: any) {