-
-
Notifications
You must be signed in to change notification settings - Fork 16.4k
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
[suggestion] send/respond with blob #4807
Comments
I think this is a great idea. |
Yeay, then I could take advantage of fetch-blob/from.js methods that can retrieve a Blob/File from the file system. or use undici or node-fetch If you would accept 3th party blob look-a-like objects ofc... this idea came to me when i worked on a current project that uses a template engine. var cons = require('consolidate');
cons.swig('views/page.html', function(err, blob){
res.send(blob)
}); So if Blob are not the only thing you are going to support, then there is one extra idea coming from the |
Hi @dougwilson , i want to take up this issue can you please assign me ? |
fyi, NodeJS just shipped |
No worries, there is a PR open that is very close to landing 👍 . Should be in the next Express release. |
I think we can close this one for now. |
NodeJS now has support for Blob's globally,
...earlier you had to load it from
require('buffer').Blob
it would be cool / awesome if it where possible to respond with a Blob by doing something like
Doing this would take care of
content-type
to the blob's type (only if content-type haven't been set manually)content-length
to the blob's sizeblob.stream()
to the responseres.download(blob)
then it would also add content-disposition attachment headerit's also looking like if node will at some point add a way of getting blobs from the filesystem also, but i don't know when.ref: nodejs/node#39015
edit: NodeJS just shipped
fs.openAsBlob(path, { type })
in v20+The text was updated successfully, but these errors were encountered: