Skip to content
Open
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
14 changes: 7 additions & 7 deletions lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var findVolume = function (startPath, startStat) {
}

var utf16be = function (str) {
var b = new Buffer(str, 'ucs2')
var b = Buffer.from(str, 'ucs2')
for (var i = 0; i < b.length; i += 2) {
var a = b[i]
b[i] = b[i + 1]
Expand Down Expand Up @@ -70,7 +70,7 @@ module.exports = exports = function (targetPath) {
};

(function addType0 () {
var b = new Buffer(info.parent.name, 'utf8')
var b = Buffer.from(info.parent.name, 'utf8')

info.extra.push({
type: 0,
Expand All @@ -80,7 +80,7 @@ module.exports = exports = function (targetPath) {
}());

(function addType1 () {
var b = new Buffer(4)
var b = Buffer.alloc(4)

b.writeUInt32BE(info.parent.id, 0)

Expand All @@ -93,7 +93,7 @@ module.exports = exports = function (targetPath) {

(function addType14 () {
var l = info.target.filename.length
var b = new Buffer(2 + (l * 2))
var b = Buffer.alloc(2 + (l * 2))

b.writeUInt16BE(l, 0)
utf16be(info.target.filename).copy(b, 2)
Expand All @@ -107,7 +107,7 @@ module.exports = exports = function (targetPath) {

(function addType15 () {
var l = info.volume.name.length
var b = new Buffer(2 + (l * 2))
var b = Buffer.alloc(2 + (l * 2))

b.writeUInt16BE(l, 0)
utf16be(info.volume.name).copy(b, 2)
Expand All @@ -123,7 +123,7 @@ module.exports = exports = function (targetPath) {
var vl = volumePath.length
assert.equal(targetPath.slice(0, vl), volumePath)
var lp = targetPath.slice(vl)
var b = new Buffer(lp, 'utf8')
var b = Buffer.from(lp, 'utf8')

info.extra.push({
type: 18,
Expand All @@ -133,7 +133,7 @@ module.exports = exports = function (targetPath) {
}());

(function addType19 () {
var b = new Buffer(volumePath, 'utf8')
var b = Buffer.from(volumePath, 'utf8')

info.extra.push({
type: 19,
Expand Down
2 changes: 1 addition & 1 deletion lib/encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = exports = function (info) {
}, 0)
var trailerLength = 4

var buf = new Buffer(baseLength + extraLength + trailerLength)
var buf = Buffer.alloc(baseLength + extraLength + trailerLength)

buf.writeUInt32BE(0, 0)

Expand Down
2 changes: 1 addition & 1 deletion lib/is-alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = function isAlias (path) {
var fd = fs.openSync(path, 'r')

try {
read = new Buffer(16)
read = Buffer.alloc(16)
fs.readSync(fd, read, 0, 16, 0)
} finally {
fs.closeSync(fd)
Expand Down
6 changes: 3 additions & 3 deletions test/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var path = require('path')
var temp = require('fs-temp')
var assert = require('assert')

var rawData = new Buffer(
var rawData = Buffer.from(
'AAAAAAEqAAIAAApUZXN0IFRpdGxlAAAAAAAAAAAAAAAAAAAAAADO615USCsA' +
'BQAAABMMVGVzdEJrZy50aWZmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFM7rXlgAAAAAAAAAAP////8A' +
Expand Down Expand Up @@ -70,8 +70,8 @@ describe('isAlias', function () {
var aliasFile, garbageFile

before(function () {
aliasFile = temp.writeFileSync(new Buffer('626f6f6b000000006d61726b00000000', 'hex'))
garbageFile = temp.writeFileSync(new Buffer('Hello my name is Linus!'))
aliasFile = temp.writeFileSync(Buffer.from('626f6f6b000000006d61726b00000000', 'hex'))
garbageFile = temp.writeFileSync(Buffer.from('Hello my name is Linus!'))
})

after(function () {
Expand Down