question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement `res.sendFile`

See original GitHub issue

Is your feature request related to a problem? Please describe.

res.sendFile is commonly used in Express apps. tinyhttp must have one too.

Describe the solution you’d like

Implement res.sendFile based on existing res.send function

Additional context

Express docs reference: http://expressjs.com/en/5x/api.html#res.sendFile Express implementation: https://github.com/expressjs/express/blob/ecd8a08c1c9c4d60b466b451fd1f5c3fe8a5fb23/lib/response.js#L403

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
talentlessguycommented, Aug 30, 2020

@ahmad-reza619 yeah must work the same

code might differ

1reaction
talentlessguycommented, Sep 17, 2020

implemented in 2bba94ce9ee521a3bc10d448757c73889f6f8e1c, but not 1:1 to express

need more time to make it have the same API

Read more comments on GitHub >

github_iconTop Results From Across the Web

Express.js res.sendFile() Function - GeeksforGeeks
The res.sendFile() function basically transfers the file at the given path and it sets the Content-Type response HTTP header field based on ...
Read more >
res.sendFile absolute path - node.js - Stack Overflow
You need to use an absolute path directly with res.sendFile . There are two simple ways to do it: res.sendFile(path.join(__dirname, '.
Read more >
API Reference - Express 4.x
Creates an Express application. The express() function is a top-level function exported by the express module. var express = require('express') var app ...
Read more >
Using Express res.sendFile() Function to Serve Files
Express provides a method in the response object of the router called sendFile() that can be used to serve static files. res.sendFile() method ......
Read more >
Send Static Files in Express with sendFile() - Mastering JS
Express ' sendFile() function lets you send a raw file as a response to an HTTP request. You can think of res.sendFile() as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found