Minor clean-up

This commit is contained in:
Jesús Leganés Combarro "piranna 2015-10-11 18:24:53 +02:00
parent 02bbe131f2
commit a311be903f
2 changed files with 9 additions and 9 deletions

View file

@ -190,15 +190,13 @@ exports.encode = function(opts) {
} }
exports.decode = function(buf) { exports.decode = function(buf) {
var typeflag = buf[156] === 0 ? 0 : buf[156] - ZERO_OFFSET
var type = toType(typeflag)
var name = decodeStr(buf, 0, 100) var name = decodeStr(buf, 0, 100)
var mode = decodeOct(buf, 100) var mode = decodeOct(buf, 100)
var uid = decodeOct(buf, 108) var uid = decodeOct(buf, 108)
var gid = decodeOct(buf, 116) var gid = decodeOct(buf, 116)
var size = decodeOct(buf, 124) var size = decodeOct(buf, 124)
var mtime = decodeOct(buf, 136) var mtime = decodeOct(buf, 136)
var type = toType(buf[156] === 0 ? 0 : buf[156] - ZERO_OFFSET)
var linkname = buf[157] === 0 ? null : decodeStr(buf, 157, 100) var linkname = buf[157] === 0 ? null : decodeStr(buf, 157, 100)
var uname = decodeStr(buf, 265, 32) var uname = decodeStr(buf, 265, 32)
var gname = decodeStr(buf, 297, 32) var gname = decodeStr(buf, 297, 32)
@ -222,7 +220,7 @@ exports.decode = function(buf) {
gid: gid, gid: gid,
size: size, size: size,
mtime: new Date(1000 * mtime), mtime: new Date(1000 * mtime),
type: toType(typeflag), type: type,
linkname: linkname, linkname: linkname,
uname: uname, uname: uname,
gname: gname, gname: gname,

View file

@ -1,10 +1,12 @@
var util = require('util')
var eos = require('end-of-stream') var eos = require('end-of-stream')
var headers = require('./headers') var util = require('util')
var Readable = require('readable-stream').Readable var Readable = require('readable-stream').Readable
var Writable = require('readable-stream').Writable
var PassThrough = require('readable-stream').PassThrough var PassThrough = require('readable-stream').PassThrough
var Writable = require('readable-stream').Writable
var headers = require('./headers')
var END_OF_TAR = new Buffer(1024) var END_OF_TAR = new Buffer(1024)
END_OF_TAR.fill(0) END_OF_TAR.fill(0)