From a311be903fb14732c8c722fb7bd9907d0ea0a0f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s=20Combarro=20=22piranna?= Date: Sun, 11 Oct 2015 18:24:53 +0200 Subject: [PATCH] Minor clean-up --- headers.js | 6 ++---- pack.js | 12 +++++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/headers.js b/headers.js index 19c3da3..cab8803 100644 --- a/headers.js +++ b/headers.js @@ -190,15 +190,13 @@ exports.encode = function(opts) { } 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 mode = decodeOct(buf, 100) var uid = decodeOct(buf, 108) var gid = decodeOct(buf, 116) var size = decodeOct(buf, 124) 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 uname = decodeStr(buf, 265, 32) var gname = decodeStr(buf, 297, 32) @@ -222,7 +220,7 @@ exports.decode = function(buf) { gid: gid, size: size, mtime: new Date(1000 * mtime), - type: toType(typeflag), + type: type, linkname: linkname, uname: uname, gname: gname, diff --git a/pack.js b/pack.js index eec3496..1de304c 100644 --- a/pack.js +++ b/pack.js @@ -1,10 +1,12 @@ -var util = require('util') -var eos = require('end-of-stream') +var eos = require('end-of-stream') +var util = require('util') + +var Readable = require('readable-stream').Readable +var PassThrough = require('readable-stream').PassThrough +var Writable = require('readable-stream').Writable + var headers = require('./headers') -var Readable = require('readable-stream').Readable -var Writable = require('readable-stream').Writable -var PassThrough = require('readable-stream').PassThrough var END_OF_TAR = new Buffer(1024) END_OF_TAR.fill(0)