Skip to content

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

License

Notifications You must be signed in to change notification settings

mafintosh/http-file-response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published