updated npm modules

This commit is contained in:
2019-05-20 20:43:45 -05:00
parent 2319197b81
commit f166b72b7d
1113 changed files with 8758 additions and 12227 deletions

View File

@@ -1,3 +1,8 @@
0.5.3 / 2018-12-17
==================
* Use `safe-buffer` for improved Buffer API
0.5.2 / 2016-12-08
==================

View File

@@ -1,6 +1,6 @@
(The MIT License)
Copyright (c) 2014 Douglas Christopher Wilson
Copyright (c) 2014-2017 Douglas Christopher Wilson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -16,6 +16,8 @@ $ npm install content-disposition
## API
<!-- eslint-disable no-unused-vars -->
```js
var contentDisposition = require('content-disposition')
```
@@ -26,6 +28,8 @@ Create an attachment `Content-Disposition` header value using the given file nam
if supplied. The `filename` is optional and if no file name is desired, but you
want to specify `options`, set `filename` to `undefined`.
<!-- eslint-disable no-undef -->
```js
res.setHeader('Content-Disposition', contentDisposition('∫ maths.pdf'))
```
@@ -66,8 +70,10 @@ it). The type is normalized to lower-case.
### contentDisposition.parse(string)
<!-- eslint-disable no-undef, no-unused-vars -->
```js
var disposition = contentDisposition.parse('attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt');
var disposition = contentDisposition.parse('attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt')
```
Parse a `Content-Disposition` header string. This automatically handles extended
@@ -88,12 +94,13 @@ are shown for the string `'attachment; filename="EURO rates.txt"; filename*=UTF-
```js
var contentDisposition = require('content-disposition')
var destroy = require('destroy')
var fs = require('fs')
var http = require('http')
var onFinished = require('on-finished')
var filePath = '/path/to/public/plans.pdf'
http.createServer(function onRequest(req, res) {
http.createServer(function onRequest (req, res) {
// set headers
res.setHeader('Content-Type', 'application/pdf')
res.setHeader('Content-Disposition', contentDisposition(filePath))
@@ -101,7 +108,7 @@ http.createServer(function onRequest(req, res) {
// send file
var stream = fs.createReadStream(filePath)
stream.pipe(res)
onFinished(res, function (err) {
onFinished(res, function () {
destroy(stream)
})
})
@@ -129,13 +136,13 @@ $ npm test
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/content-disposition.svg?style=flat
[npm-image]: https://img.shields.io/npm/v/content-disposition.svg
[npm-url]: https://npmjs.org/package/content-disposition
[node-version-image]: https://img.shields.io/node/v/content-disposition.svg?style=flat
[node-version-image]: https://img.shields.io/node/v/content-disposition.svg
[node-version-url]: https://nodejs.org/en/download
[travis-image]: https://img.shields.io/travis/jshttp/content-disposition.svg?style=flat
[travis-image]: https://img.shields.io/travis/jshttp/content-disposition.svg
[travis-url]: https://travis-ci.org/jshttp/content-disposition
[coveralls-image]: https://img.shields.io/coveralls/jshttp/content-disposition.svg?style=flat
[coveralls-image]: https://img.shields.io/coveralls/jshttp/content-disposition.svg
[coveralls-url]: https://coveralls.io/r/jshttp/content-disposition?branch=master
[downloads-image]: https://img.shields.io/npm/dm/content-disposition.svg?style=flat
[downloads-image]: https://img.shields.io/npm/dm/content-disposition.svg
[downloads-url]: https://npmjs.org/package/content-disposition

View File

@@ -1,6 +1,6 @@
/*!
* content-disposition
* Copyright(c) 2014 Douglas Christopher Wilson
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/
@@ -8,6 +8,7 @@
/**
* Module exports.
* @public
*/
module.exports = contentDisposition
@@ -15,18 +16,22 @@ module.exports.parse = parse
/**
* Module dependencies.
* @private
*/
var basename = require('path').basename
var Buffer = require('safe-buffer').Buffer
/**
* RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%")
* @private
*/
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g // eslint-disable-line no-control-regex
/**
* RegExp to match percent encoding escape.
* @private
*/
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/
@@ -34,6 +39,7 @@ var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g
/**
* RegExp to match non-latin1 characters.
* @private
*/
var NON_LATIN1_REGEXP = /[^\x20-\x7e\xa0-\xff]/g
@@ -43,12 +49,14 @@ var NON_LATIN1_REGEXP = /[^\x20-\x7e\xa0-\xff]/g
*
* quoted-pair = "\" CHAR
* CHAR = <any US-ASCII character (octets 0 - 127)>
* @private
*/
var QESC_REGEXP = /\\([\u0000-\u007f])/g
var QESC_REGEXP = /\\([\u0000-\u007f])/g // eslint-disable-line no-control-regex
/**
* RegExp to match chars that must be quoted-pair in RFC 2616
* @private
*/
var QUOTE_REGEXP = /([\\"])/g
@@ -75,6 +83,7 @@ var QUOTE_REGEXP = /([\\"])/g
* HT = <US-ASCII HT, horizontal-tab (9)>
* CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
* OCTET = <any 8-bit sequence of data>
* @private
*/
var PARAM_REGEXP = /;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g // eslint-disable-line no-control-regex
@@ -100,6 +109,7 @@ var TOKEN_REGEXP = /^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/
* attr-char = ALPHA / DIGIT
* / "!" / "#" / "$" / "&" / "+" / "-" / "."
* / "^" / "_" / "`" / "|" / "~"
* @private
*/
var EXT_VALUE_REGEXP = /^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/
@@ -115,6 +125,7 @@ var EXT_VALUE_REGEXP = /^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-
* disp-ext-parm = token "=" value
* | ext-token "=" ext-value
* ext-token = <the characters in token, followed by "*">
* @private
*/
var DISPOSITION_TYPE_REGEXP = /^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/ // eslint-disable-line no-control-regex
@@ -127,7 +138,7 @@ var DISPOSITION_TYPE_REGEXP = /^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/
* @param {string} [options.type=attachment]
* @param {string|boolean} [options.fallback=true]
* @return {string}
* @api public
* @public
*/
function contentDisposition (filename, options) {
@@ -149,7 +160,7 @@ function contentDisposition (filename, options) {
* @param {string} [filename]
* @param {string|boolean} [fallback=true]
* @return {object}
* @api private
* @private
*/
function createparams (filename, fallback) {
@@ -210,7 +221,7 @@ function createparams (filename, fallback) {
* @param {string} obj.type
* @param {object} [obj.parameters]
* @return {string}
* @api private
* @private
*/
function format (obj) {
@@ -248,7 +259,7 @@ function format (obj) {
*
* @param {string} str
* @return {string}
* @api private
* @private
*/
function decodefield (str) {
@@ -270,7 +281,7 @@ function decodefield (str) {
value = getlatin1(binary)
break
case 'utf-8':
value = new Buffer(binary, 'binary').toString('utf8')
value = Buffer.from(binary, 'binary').toString('utf8')
break
default:
throw new TypeError('unsupported charset in extended field')
@@ -284,7 +295,7 @@ function decodefield (str) {
*
* @param {string} val
* @return {string}
* @api private
* @private
*/
function getlatin1 (val) {
@@ -297,7 +308,7 @@ function getlatin1 (val) {
*
* @param {string} string
* @return {object}
* @api private
* @public
*/
function parse (string) {
@@ -378,7 +389,7 @@ function parse (string) {
* @param {string} str
* @param {string} hex
* @return {string}
* @api private
* @private
*/
function pdecode (str, hex) {
@@ -390,17 +401,14 @@ function pdecode (str, hex) {
*
* @param {string} char
* @return {string}
* @api private
* @private
*/
function pencode (char) {
var hex = String(char)
return '%' + String(char)
.charCodeAt(0)
.toString(16)
.toUpperCase()
return hex.length === 1
? '%0' + hex
: '%' + hex
}
/**
@@ -408,7 +416,7 @@ function pencode (char) {
*
* @param {string} val
* @return {string}
* @api private
* @private
*/
function qstring (val) {
@@ -422,7 +430,7 @@ function qstring (val) {
*
* @param {string} val
* @return {string}
* @api private
* @private
*/
function ustring (val) {
@@ -437,6 +445,11 @@ function ustring (val) {
/**
* Class for parsed Content-Disposition header for v8 optimization
*
* @public
* @param {string} type
* @param {object} parameters
* @constructor
*/
function ContentDisposition (type, parameters) {

View File

@@ -1,46 +1,51 @@
{
"_from": "content-disposition@0.5.2",
"_id": "content-disposition@0.5.2",
"_from": "content-disposition@0.5.3",
"_id": "content-disposition@0.5.3",
"_inBundle": false,
"_integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=",
"_integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
"_location": "/content-disposition",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "content-disposition@0.5.2",
"raw": "content-disposition@0.5.3",
"name": "content-disposition",
"escapedName": "content-disposition",
"rawSpec": "0.5.2",
"rawSpec": "0.5.3",
"saveSpec": null,
"fetchSpec": "0.5.2"
"fetchSpec": "0.5.3"
},
"_requiredBy": [
"/express"
],
"_resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
"_shasum": "0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4",
"_spec": "content-disposition@0.5.2",
"_resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
"_shasum": "e130caf7e7279087c5616c2007d0485698984fbd",
"_spec": "content-disposition@0.5.3",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\express",
"author": {
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
},
"bugs": {
"url": "https://github.com/jshttp/content-disposition/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
}
],
"dependencies": {
"safe-buffer": "5.1.2"
},
"deprecated": false,
"description": "Create and parse Content-Disposition header",
"devDependencies": {
"eslint": "3.11.1",
"eslint-config-standard": "6.2.1",
"eslint-plugin-promise": "3.3.0",
"eslint-plugin-standard": "2.0.1",
"deep-equal": "1.0.1",
"eslint": "5.10.0",
"eslint-config-standard": "12.0.0",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-markdown": "1.0.0-rc.1",
"eslint-plugin-node": "7.0.1",
"eslint-plugin-promise": "4.0.1",
"eslint-plugin-standard": "4.0.0",
"istanbul": "0.4.5",
"mocha": "1.21.5"
"mocha": "5.2.0"
},
"engines": {
"node": ">= 0.6"
@@ -65,10 +70,10 @@
"url": "git+https://github.com/jshttp/content-disposition.git"
},
"scripts": {
"lint": "eslint .",
"lint": "eslint --plugin markdown --ext js,md .",
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
},
"version": "0.5.2"
"version": "0.5.3"
}