-
Notifications
You must be signed in to change notification settings - Fork 0
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
getFile fails on large files #6
Comments
The error on the Python side is likely because There are at least two implementations of I have considered a similar approach to yours, which can be useful in some cases, but many APIs use internal methods to read data from await new Response(new Blob([NONSTANDARD_File,'data'])).text() Therefore, if the feature is implemented, it may be required to call Do you need to read the contents of large files for your use case? If not, you can skip processing those files. |
Sorry for the late reply. Yes, I plan to read those files and upload them somewhere, but since it's just for a small local experiment, if it's not an easy solution I'll just live with having to use chrome or edge for now. |
Starting from v0.9.4, there will be three ways to read large files:
|
I was trying to list files and their sizes in a directory with some large (>1GB) files and noticed that the extension throws an exception even though I didn't really attempt to load any content and simply wanted to get the size via
getFile
(which works fine in Chrome):DOMException: The requested file could not be read, the file size exceeded the allowed limit.
After looking through the extension code I noticed that in https://github.com/ichaoX/ext-file/blob/main/src/lib/api/fs.js#L302C27-L302C27 the whole file is loaded into memory and there is a config value to limit it. Removing that value gave me another error which seems to come from the python side:
Error Too much data for base64 line
I'm not entirely sure what Chrome is doing internally, but seeing how
getFile
takes literally no time to return regardless of the file size, I feel it doesn't actually load the content until it is accessed viatext()
,stream()
orarrayBuffer()
.So I played around a bit attempting to create modified
File
objects (seeing how it is actually just an interface) and while it does allow to replace the functions above with custom code, it seems that Chrome still somehow loads the content when trying to store the file in an indexDB without using any of the custom functions. Guess in the end it would again require special care in the application code to ensure that it behaves the same across browsers if it was done in this fashion.Here is the code I wrote to see if I can replace the functions with my own:
Maybe you could still try loading the content in
getFile
in smaller segments to avoid the base64 error.The text was updated successfully, but these errors were encountered: