web: fix bulk exists check for files

This commit is contained in:
Abdullah Atta
2024-08-03 11:19:52 +05:00
committed by Abdullah Atta
parent dbc907ceeb
commit 02fdec74ce

View File

@@ -576,9 +576,10 @@ async function exists(filename: string | FileHandle) {
}
async function bulkExists(filenames: string[]) {
return Array.from(
new Set(filenames).difference(new Set(await streamablefs.list())).values()
const files = (await streamablefs.list()).map((c) =>
c.replace(/-chunk-\d+/, "")
);
return Array.from(new Set(filenames).difference(new Set(files)).values());
}
type FileMetadata = {