Skip to content

Commit

Permalink
Use safe-buffer for improved Buffer API
Browse files Browse the repository at this point in the history
closes #21
  • Loading branch information
ChALkeR authored and dougwilson committed Mar 22, 2018
1 parent 1220d87 commit d542fa5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
unreleased
==========

* Use `safe-buffer` for improved Buffer API

0.5.2 / 2016-12-08
==================

Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports.parse = parse
*/

var basename = require('path').basename
var Buffer = require('safe-buffer').Buffer

/**
* RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%")
Expand Down Expand Up @@ -280,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')
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"res"
],
"repository": "jshttp/content-disposition",
"dependencies": {
"safe-buffer": "5.1.1"
},
"devDependencies": {
"eslint": "3.19.0",
"eslint-config-standard": "7.0.0",
Expand Down

0 comments on commit d542fa5

Please sign in to comment.