mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
web: check file size when checking for file existence
This commit is contained in:
committed by
Ammar Ahmed
parent
1f2948c9a5
commit
3b6fde2ea6
@@ -504,8 +504,12 @@ async function downloadFile(filename: string, requestOptions: RequestOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
function exists(filename: string) {
|
||||
return streamablefs.exists(filename);
|
||||
async function exists(filename: string) {
|
||||
const handle = await streamablefs.readFile(filename);
|
||||
return (
|
||||
handle &&
|
||||
handle.file.size === (await handle.size()) - handle.file.chunks * ABYTES
|
||||
);
|
||||
}
|
||||
|
||||
type FileMetadata = {
|
||||
|
||||
Reference in New Issue
Block a user