content-disposition
Advanced tools
Comparing version 0.5.2 to 0.5.3
@@ -0,1 +1,6 @@ | ||
0.5.3 / 2018-12-17 | ||
================== | ||
* Use `safe-buffer` for improved Buffer API | ||
0.5.2 / 2016-12-08 | ||
@@ -2,0 +7,0 @@ ================== |
47
index.js
/*! | ||
* content-disposition | ||
* Copyright(c) 2014 Douglas Christopher Wilson | ||
* Copyright(c) 2014-2017 Douglas Christopher Wilson | ||
* MIT Licensed | ||
@@ -11,2 +11,3 @@ */ | ||
* Module exports. | ||
* @public | ||
*/ | ||
@@ -19,8 +20,11 @@ | ||
* 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 | ||
*/ | ||
@@ -32,2 +36,3 @@ | ||
* RegExp to match percent encoding escape. | ||
* @private | ||
*/ | ||
@@ -40,2 +45,3 @@ | ||
* RegExp to match non-latin1 characters. | ||
* @private | ||
*/ | ||
@@ -50,8 +56,10 @@ | ||
* 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 | ||
*/ | ||
@@ -83,2 +91,3 @@ | ||
* OCTET = <any 8-bit sequence of data> | ||
* @private | ||
*/ | ||
@@ -109,2 +118,3 @@ | ||
* / "^" / "_" / "`" / "|" / "~" | ||
* @private | ||
*/ | ||
@@ -125,2 +135,3 @@ | ||
* ext-token = <the characters in token, followed by "*"> | ||
* @private | ||
*/ | ||
@@ -138,3 +149,3 @@ | ||
* @return {string} | ||
* @api public | ||
* @public | ||
*/ | ||
@@ -161,3 +172,3 @@ | ||
* @return {object} | ||
* @api private | ||
* @private | ||
*/ | ||
@@ -223,3 +234,3 @@ | ||
* @return {string} | ||
* @api private | ||
* @private | ||
*/ | ||
@@ -262,3 +273,3 @@ | ||
* @return {string} | ||
* @api private | ||
* @private | ||
*/ | ||
@@ -285,3 +296,3 @@ | ||
case 'utf-8': | ||
value = new Buffer(binary, 'binary').toString('utf8') | ||
value = Buffer.from(binary, 'binary').toString('utf8') | ||
break | ||
@@ -300,3 +311,3 @@ default: | ||
* @return {string} | ||
* @api private | ||
* @private | ||
*/ | ||
@@ -314,3 +325,3 @@ | ||
* @return {object} | ||
* @api private | ||
* @public | ||
*/ | ||
@@ -396,3 +407,3 @@ | ||
* @return {string} | ||
* @api private | ||
* @private | ||
*/ | ||
@@ -409,13 +420,10 @@ | ||
* @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 | ||
} | ||
@@ -428,3 +436,3 @@ | ||
* @return {string} | ||
* @api private | ||
* @private | ||
*/ | ||
@@ -443,3 +451,3 @@ | ||
* @return {string} | ||
* @api private | ||
* @private | ||
*/ | ||
@@ -459,2 +467,7 @@ | ||
* Class for parsed Content-Disposition header for v8 optimization | ||
* | ||
* @public | ||
* @param {string} type | ||
* @param {object} parameters | ||
* @constructor | ||
*/ | ||
@@ -461,0 +474,0 @@ |
{ | ||
"name": "content-disposition", | ||
"description": "Create and parse Content-Disposition header", | ||
"version": "0.5.2", | ||
"contributors": [ | ||
"Douglas Christopher Wilson <doug@somethingdoug.com>" | ||
], | ||
"version": "0.5.3", | ||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
"license": "MIT", | ||
@@ -16,9 +14,16 @@ "keywords": [ | ||
"repository": "jshttp/content-disposition", | ||
"dependencies": { | ||
"safe-buffer": "5.1.2" | ||
}, | ||
"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" | ||
}, | ||
@@ -35,3 +40,3 @@ "files": [ | ||
"scripts": { | ||
"lint": "eslint .", | ||
"lint": "eslint --plugin markdown --ext js,md .", | ||
"test": "mocha --reporter spec --bail --check-leaks test/", | ||
@@ -38,0 +43,0 @@ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", |
@@ -19,2 +19,4 @@ # content-disposition | ||
<!-- eslint-disable no-unused-vars --> | ||
```js | ||
@@ -30,2 +32,4 @@ var contentDisposition = require('content-disposition') | ||
<!-- eslint-disable no-undef --> | ||
```js | ||
@@ -71,4 +75,6 @@ res.setHeader('Content-Disposition', contentDisposition('∫ maths.pdf')) | ||
<!-- 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') | ||
``` | ||
@@ -94,2 +100,3 @@ | ||
var destroy = require('destroy') | ||
var fs = require('fs') | ||
var http = require('http') | ||
@@ -100,3 +107,3 @@ var onFinished = require('on-finished') | ||
http.createServer(function onRequest(req, res) { | ||
http.createServer(function onRequest (req, res) { | ||
// set headers | ||
@@ -109,3 +116,3 @@ res.setHeader('Content-Type', 'application/pdf') | ||
stream.pipe(res) | ||
onFinished(res, function (err) { | ||
onFinished(res, function () { | ||
destroy(stream) | ||
@@ -138,11 +145,11 @@ }) | ||
[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 |
Sorry, the diff of this file is not supported yet
19115
370
149
1
10
+ Addedsafe-buffer@5.1.2
+ Addedsafe-buffer@5.1.2(transitive)