-
Notifications
You must be signed in to change notification settings - Fork 225
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
async setHeaders callback #21
Comments
The way the But even then, it looks like you just want to do something using the file's setHeaders: function(res, path, stat) {
res.set('X-Raw-Length', stat.size)
} |
I use the But this works perfectly! Thanks for the super quick reply. I'll update the documentation to add the |
Ah. I took a closer look into the Ans the reason it's sync instead of async is because But thanks for the docs contribution, and I'm glad we could solve your problem with something that was just accidentally not documented (it's documented all the way down in |
Happy to help. These projects are getting even better than last time I used them. You seem to run a tight ship :) |
Most API's in express (and node) are async, but
setHeaders
callback here isn't. Here is a current use case that I have:I'm doing this to show a progress bar on the client-side when loading a big resource. Content-length won't work when the content is gzipped.
Of course, this doesn't work because by the time
fs.stat
comes back the response might have ended.The text was updated successfully, but these errors were encountered: