-
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
add a README.me with an example #1
Comments
I saw the example in the README and I wonder if one always needs to create the ArrayBuffer for files manually. May it be integrated in the lib (like it probably was before) ? Also, I remember, at least in the original code there were parts responsible for large files, to not load them into memory completely. Not sure if it was really functional... But using ArrayBuffer is always loading the entire file, am I right ? |
Yes we could have the lib handle file loading and just have the user provide some url but then it will rely on a callback of some sort. I thought it would make more sense for the lib to only focus on file parsing rather than handling file loading but I can change it if you prefer it that way no problem. ArrayBuffer is always loading the entire file yes as far as I know. The previous version that was dealing with that was using an arraybuffer when the user provided an url and the filereader api when it was a local file (or file object). The parser would only load the headers and then each "classes" had to either load thing themselves if it was a file object or could just function as usual if provided with a buffer. I didn't think it made much sense to keep it since it made the code less clear and that we were not going to use it but it was hard to totally understand so maybe I missed something. I'm not totally sure that it was working since I only worked with url when trying the library but if you think it would make sense to add it back so it can work with local file we could try no problem. |
Couldn't it be used both ways, either accepting ArrayBuffer or file path with a similar API ?
You are right that we currently (and in the foreseeable future) don't need this way of operation, so this was more the question out of curiosity. In the distant future, if we continue to support this library, this could be added. |
Unrelated to previous comment. |
Yes it could but then the user would have to provide a callback. I will try that and let you know |
ok I can do that no problem |
In current example, readFile function which uses FITSReader inside is provided as a callback to getFile. will it be different from this approach? |
We could use a promise like in the getFile approach yes, the call to parseFile() would return a promise instead of a fits object directly and then the promise would resolve with the fits object when loading and parsing are complete. I will just need to test that it doesn't break anything since it would be a bit different than just having a callback executed but it should be fine yes. Will try that and push the changes when it's ok |
No description provided.
The text was updated successfully, but these errors were encountered: