no deprecation on 10
This commit is contained in:
parent
d38b9661d2
commit
01aa7ef5d1
3 changed files with 10 additions and 10 deletions
11
headers.js
11
headers.js
|
@ -1,3 +1,6 @@
|
|||
var toBuffer = require('to-buffer')
|
||||
var alloc = require('buffer-alloc')
|
||||
|
||||
var ZEROS = '0000000000000000000'
|
||||
var SEVENS = '7777777777777777777'
|
||||
var ZERO_OFFSET = '0'.charCodeAt(0)
|
||||
|
@ -71,12 +74,6 @@ var toTypeflag = function (flag) {
|
|||
return 0
|
||||
}
|
||||
|
||||
var alloc = function (size) {
|
||||
var buf = new Buffer(size)
|
||||
buf.fill(0)
|
||||
return buf
|
||||
}
|
||||
|
||||
var indexOf = function (block, num, offset, end) {
|
||||
for (; offset < end; offset++) {
|
||||
if (block[offset] === num) return offset
|
||||
|
@ -175,7 +172,7 @@ exports.encodePax = function (opts) { // TODO: encode more stuff in pax
|
|||
result += addLength(' ' + key + '=' + pax[key] + '\n')
|
||||
}
|
||||
}
|
||||
return new Buffer(result)
|
||||
return toBuffer(result)
|
||||
}
|
||||
|
||||
exports.decodePax = function (buf) {
|
||||
|
|
7
pack.js
7
pack.js
|
@ -1,6 +1,8 @@
|
|||
var constants = require('constants')
|
||||
var eos = require('end-of-stream')
|
||||
var util = require('util')
|
||||
var alloc = require('buffer-alloc')
|
||||
var toBuffer = require('to-buffer')
|
||||
|
||||
var Readable = require('readable-stream').Readable
|
||||
var Writable = require('readable-stream').Writable
|
||||
|
@ -11,8 +13,7 @@ var headers = require('./headers')
|
|||
var DMODE = parseInt('755', 8)
|
||||
var FMODE = parseInt('644', 8)
|
||||
|
||||
var END_OF_TAR = new Buffer(1024)
|
||||
END_OF_TAR.fill(0)
|
||||
var END_OF_TAR = alloc(1024)
|
||||
|
||||
var noop = function () {}
|
||||
|
||||
|
@ -124,7 +125,7 @@ Pack.prototype.entry = function (header, buffer, callback) {
|
|||
if (!header.gid) header.gid = 0
|
||||
if (!header.mtime) header.mtime = new Date()
|
||||
|
||||
if (typeof buffer === 'string') buffer = new Buffer(buffer)
|
||||
if (typeof buffer === 'string') buffer = toBuffer(buffer)
|
||||
if (Buffer.isBuffer(buffer)) {
|
||||
header.size = buffer.length
|
||||
this._encode(header)
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"bl": "^1.0.0",
|
||||
"buffer-alloc": "^1.1.0",
|
||||
"end-of-stream": "^1.0.0",
|
||||
"readable-stream": "^2.0.0",
|
||||
"to-buffer": "^1.1.0",
|
||||
"xtend": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
Loading…
Reference in a new issue