better type support

This commit is contained in:
Mathias Buus 2013-12-21 01:23:36 +01:00
parent 1328813c86
commit aec83fd34e
2 changed files with 17 additions and 7 deletions

View file

@ -65,9 +65,11 @@ Most of these values can be found by stating a file.
name: 'path/to/this/entry.txt',
size: 1314, // entry size. defaults to 0
mode: 0644, // entry mode. defaults to to 0755 for dirs and 0644 otherwise
mtime: new Date(), // last modified date for entry
type: 'file', // type of entry. can be file|directory|link|block|character|fifo
linkname: 'path', //
mtime: new Date(), // last modified date for entry. defaults to now.
type: 'file', // type of entry. defaults to file. can be:
// file | link | symlink | directory | block-device
// character-device | fifo | contigious-file
linkname: 'path', // linked file name
uid: 0, // uid of entry owner. defaults to 0
gid: 0, // gid of entry owner. defaults to 0
uname: 'maf', // uname of entry owner. defaults to null

View file

@ -6,14 +6,18 @@ var toType = function(flag) {
switch (flag) {
case 1:
return 'link';
case 2:
return 'symlink';
case 3:
return 'character';
return 'character-device';
case 4:
return 'block';
return 'block-device';
case 5:
return 'directory';
case 6:
return 'fifo';
case 7:
return 'contiguous-file'
}
return 'file';
};
@ -22,14 +26,18 @@ var toTypeflag = function(flag) {
switch (flag) {
case 'link':
return 1;
case 'character':
case 'symlink':
return 2;
case 'character-device':
return 3;
case 'block':
case 'block-device':
return 4;
case 'directory':
return 5;
case 'fifo':
return 6;
case 'contiguous-file':
return 7;
}
return 0;