Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace deprecated Buffer constructor usage #7

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = function(opt, cb) {
//we need to convert it into a regular Buffer object
if (isArrayBuffer(body)) {
var array = new Uint8Array(body)
body = new Buffer(array, 'binary')
body = Buffer.from(array, 'binary')
}

//now check the string/Buffer response
Expand All @@ -45,7 +45,7 @@ module.exports = function(opt, cb) {
binary = true
//if we have a string, turn it into a Buffer
if (typeof body === 'string')
body = new Buffer(body, 'binary')
body = Buffer.from(body, 'binary')
}

//we are not parsing a binary format, just ASCII/XML/etc
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function parseFont(file, data, cb) {
var result, binary

if (isBinary(data)) {
if (typeof data === 'string') data = new Buffer(data, 'binary')
if (typeof data === 'string') data = Buffer.from(data, 'binary')
binary = true
} else data = data.toString().trim()

Expand Down
2 changes: 1 addition & 1 deletion lib/is-binary.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var equal = require('buffer-equal')
var HEADER = new Buffer([66, 77, 70, 3])
var HEADER = Buffer.from([66, 77, 70, 3])

module.exports = function(buf) {
if (typeof buf === 'string')
Expand Down