-
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
Backport FileAPI to 16.x #45763
Comments
I've opened a draft pull request showing this being backported to v16.x here: #45764 |
As an alternative, undici exports a spec compliant File class. The only difference is that setting a const { File } = require('undici') |
@KhafraDev oh! I didn't know about this! I must've missed it at some point. |
Looks like it's not explicitly documented, so I'd be a little hesitant to use it. But maybe that's just a docs fix for undici |
We should definitely document it. |
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. |
I'm gunna close this out since I no longer work for the company that had the problem and I believe they've found another way. |
What is the problem this feature will solve?
In 16.x we have the Blob constructor, and in #45139, support for the
File
API was introduced. It'd be wonderful if this could be backported to v16.x, this would help us by meaning we could not use a polyfill on Node.js 16.x (we'd have to polyfill of shim at the moment).From what I can tell, the backport is possible, but with a few minor caveats:
test/wpt/test-file.js
needs theBlob
constructor set onglobalThis
to pass.File
don't work, due to them also not working withBlob
in v16.x (see below)Unusual arguments: The file at
test/wpt/status/FileAPI/file.json
needed the following expected failures added, as these are also expected failures in the Blob WPT in v16.xWhat is the feature you are proposing to solve the problem?
This is a backport of a new feature in 19.x to 16.x, and would provide an new API that would be usable with undici's fetch in 16.x (we've a module that shims node.js 18's
fetch
and undici'sfetch
on 16.x, but also need the File constructor to simplify our API which current has to accept either a Buffer or a Blob, and those constructors behave pretty differently.What alternatives have you considered?
We could also shim the File API in 16.x, just like we shim the
fetch
API, though theFile
constructor doesn't really exist as a good third-party/user-land module (due to how it extends built-ins)The text was updated successfully, but these errors were encountered: