New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

express-request-csv

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-request-csv

send csv when on request headers

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

express-request-csv

CSV's should be easy to send to users that request them. Here's how we do it

const expressRequestCSV = require('express-request-csv')
const app = express()
app.use(expressRequestCSV())
app.use('/some-data', (req, res, next) => {
  res.json([{a: 1}, {a: 2}])
})

client side

const json = await fetch('/some-data')

const csv = await fetch('/some-data', {
  headers: {
    Accept: 'text/csv'
  }
})

Configuration Options

  • Parser - Don't like json2csv? Don't use it! Swap it out with your own parser.
  • config - The configuration to pass to the new parser for the middleware instance. Uses empty object by default.
  • header - Change the header that you react to and send in Content-Type response header. Uses text/csv by default.
  • shouldUse - An optional function to check the request and determine whether the csv parser should be used. Defaults to checking the request header for text/csv
  • query - A key to check for field subsetting passed from the client in the query string. Defaults to fields.

FAQs

Package last updated on 27 Aug 2019

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