Socket
Book a DemoInstallSign in
Socket

send-promised

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

send-promised

Handy promise wrapper around the send static file server

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

send-promised

development sponsored by voltra.co

Handy promise wrapper for the send static file server.

Usage

send-promised returns whether a request could be handled by static file serving, so you can use it as the first part of your http handler function.

const send = require('send-promised')
const http = require('http')

const serve = (req, res) =>
  send({
    root: `${__dirname}/static` // and other options for `send`
  })

http.createServer(async (req, res) => {
  const served = await serve(req, res)
  if (served) return

  // handle other routes
})

Installation

$ npm install send-promised

License

MIT

FAQs

Package last updated on 21 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts