devmajor/devminor header entry

This commit is contained in:
Mathias Buus 2013-12-21 00:54:09 +01:00
parent c228622c29
commit 52af22db8d
2 changed files with 9 additions and 3 deletions

View file

@ -72,6 +72,8 @@ Most of these values can be found by stating a file.
gid: 0, // gid of entry owner. defaults to 0
uname: 'maf', // uname of entry owner. defaults to null
gname: 'staff', // gname of entry owner. defaults to null
devmajor: 0, // device major version. defaults to 0
devminor: 0 // device minor version. defaults to 0
}
```

View file

@ -95,8 +95,8 @@ exports.encode = function(opts) {
buf.write(USTAR, 257);
if (opts.uname) buf.write(opts.uname, 265);
if (opts.gname) buf.write(opts.gname, 297);
buf.write(encodeOct(0, 6), 329);
buf.write(encodeOct(0, 6), 337);
buf.write(encodeOct(opts.devmajor || 0, 6), 329);
buf.write(encodeOct(opts.devminor || 0, 6), 337);
if (prefix) buf.write(prefix, 345);
@ -116,6 +116,8 @@ exports.decode = function(buf) {
var linkname = buf[157] === 0 ? null : decodeStr(buf, 157);
var uname = decodeStr(buf, 265);
var gname = decodeStr(buf, 297);
var devmajor = decodeOct(buf, 329);
var devminor = decodeOct(buf, 337);
if (buf[345]) name = decodeStr(buf, 345)+'/'+name;
@ -131,6 +133,8 @@ exports.decode = function(buf) {
type: toType(typeflag),
linkname: linkname,
uname: uname,
gname: gname
gname: gname,
devmajor: devmajor,
devminor: devminor
};
};