web: check file size when checking for file existence

This commit is contained in:
Abdullah Atta
2023-09-20 20:26:27 +05:00
committed by Ammar Ahmed
parent 1f2948c9a5
commit 3b6fde2ea6

View File

@@ -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 = {