-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make filter async #55
Comments
I'm not really ok with this, at least not until we have a system to avoid fetching the same file multiple times. |
Ok. This is also related to the groupBy callback that should also be async if we want to be able to group by the content of the file. I would have expect that the browser would cache the value but this is indeed not the case <html>
<head>
<script src="../dist/filelist-utils.js"></script>
</head>
<body>
<script>
async function doAll() {
const fileCollection = await FileListUtil.fileCollectionFromWebservice(
'https://zakodium-oss.github.io/analysis-dataset/gcms.json',
);
for (let i = 0; i < 10; i++) {
console.log(await fileCollection.files[0].text());
console.log(await fileCollection.files[0].arrayBuffer());
await delay(5000);
}
}
function delay(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
doAll();
</script>
FileList
</body>
</html> |
we can keep this open if you want but I think it deserves a discussion/proposal before implementing anything in this library. |
Requires to solve this issue: |
Currently the filter function is similar to the one on array:
filelist-utils/src/FileCollection.ts
Lines 10 to 12 in f9abb64
I would make it async in order to be able to filter on the content of the files.
@targos ok for you ?
The text was updated successfully, but these errors were encountered: