-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
more ways of getting files #49757
Comments
The const name = path.basename(filePath)
const stat = fs.statSync(filePath)
const blob = await fs.openAsBlob(filePath)
const file = new File([blob], name, {
- type: blob.type, // this is always empty string
+ type: userProvidedMimeType,
lastModified: Number(stat.mtime)
}) This makes me wonder, wouldn't it be inconsistent that we set |
Don't mind that
👍 I would not mind if it was able to guess the correct type. But i think we could focus on that later, it dose not really affect this issue directly. |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment. For more information on how the project manages feature requests, please consult the feature request management document. |
What is the problem this feature will solve?
it's kind of a #developer-pain that
fs.openAsBlob
(aka: fs.openAsBlobSync)Blob
instead ofFile
s and therefore lacks a file name and lastModified. So upgrading them to a File requires figuring out more stuff yourself.What is the feature you are proposing to solve the problem?
That we add:
fs.openAsFile
fs.openAsFileSync
fs.openAsBlobSync
(fs: fixfs.openAsBlob
, addfs.openAsBlobSync
andfsPromises.openAsBlob
#49759)What alternatives have you considered?
Only workaround today is to do:
would be a heck a lot easier if i could just do:
and there is no way of getting around it cuz the async openAsBlob is the only thing you can work with. which makes your own code having to be async as well.
The text was updated successfully, but these errors were encountered: