normalizing style
This commit is contained in:
parent
f359eba069
commit
3da78340cb
2 changed files with 16 additions and 18 deletions
|
@ -79,7 +79,7 @@ var Extract = function(opts) {
|
||||||
try {
|
try {
|
||||||
header = self._header = headers.decode(b.slice(0, 512));
|
header = self._header = headers.decode(b.slice(0, 512));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
self.emit('error', err)
|
self.emit('error', err);
|
||||||
}
|
}
|
||||||
b.consume(512);
|
b.consume(512);
|
||||||
|
|
||||||
|
|
32
headers.js
32
headers.js
|
@ -196,23 +196,21 @@ exports.decode = function(buf) {
|
||||||
if (c === 8*32) return null;
|
if (c === 8*32) return null;
|
||||||
|
|
||||||
//valid checksum
|
//valid checksum
|
||||||
if (c === decodeOct(buf, 148))
|
if (c !== decodeOct(buf, 148)) throw new Error('invalid header');
|
||||||
return {
|
|
||||||
name: name,
|
|
||||||
mode: mode,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: size,
|
|
||||||
mtime: new Date(1000 * mtime),
|
|
||||||
type: toType(typeflag),
|
|
||||||
linkname: linkname,
|
|
||||||
uname: uname,
|
|
||||||
gname: gname,
|
|
||||||
devmajor: devmajor,
|
|
||||||
devminor: devminor
|
|
||||||
};
|
|
||||||
|
|
||||||
//invalid checksum
|
return {
|
||||||
throw new Error('invalid header');
|
name: name,
|
||||||
|
mode: mode,
|
||||||
|
uid: uid,
|
||||||
|
gid: gid,
|
||||||
|
size: size,
|
||||||
|
mtime: new Date(1000 * mtime),
|
||||||
|
type: toType(typeflag),
|
||||||
|
linkname: linkname,
|
||||||
|
uname: uname,
|
||||||
|
gname: gname,
|
||||||
|
devmajor: devmajor,
|
||||||
|
devminor: devminor
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue