http-file-response

1.0.0 • Public • Published

http-file-response

Send a file back as a HTTP response with support for range queries etc.

npm install http-file-response

Usage

const onfile = require('http-file-response')

http.createServer(function (req, res) {
  onfile('some-file.html', req, res)
})

API

onfile(filename, req, res, [options])

Options include:

{
  mime: '...', // optionally set the mimetype, defaults to infering it from the name
  fs: ... // optionally pass in your own fs impl to use
}

License

MIT

Dependents (0)

Package Sidebar

Install

npm i http-file-response

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.24 kB

Total Files

5

Last publish

Collaborators

  • mafintosh