Skip to content

Commit 4c643e9

Browse files
committed
Use safe-buffer for improved Buffer API
1 parent 1df7fe4 commit 4c643e9

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
unreleased
2+
==========
3+
4+
* Use `safe-buffer` for improved Buffer API
5+
16
1.1.0 / 2016-11-18
27
==================
38

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
'use strict'
1010

11+
/**
12+
* Module dependencies.
13+
* @private
14+
*/
15+
16+
var Buffer = require('safe-buffer').Buffer
17+
1118
/**
1219
* Module exports.
1320
* @public
@@ -68,7 +75,7 @@ function auth (req) {
6875
*/
6976

7077
function decodeBase64 (str) {
71-
return new Buffer(str, 'base64').toString()
78+
return Buffer.from(str, 'base64').toString()
7279
}
7380

7481
/**

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"basicauth"
1111
],
1212
"repository": "jshttp/basic-auth",
13+
"dependencies": {
14+
"safe-buffer": "5.1.1"
15+
},
1316
"devDependencies": {
1417
"eslint": "3.19.0",
1518
"eslint-config-standard": "6.2.1",

0 commit comments

Comments
 (0)