Skip to content

Commit

Permalink
core: define a normalized mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
ctalkington committed Apr 4, 2014
1 parent 87f5311 commit 07792ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -117,7 +117,7 @@ Sets the entry comment.

#### mode `number`

Sets the entry permissions. (experimental)
Sets the entry permissions. Defaults to octal 0755 (directory) or 0644 (file).

## Tar

Expand All @@ -143,7 +143,7 @@ Sets the entry date. This can be any valid date string or instance. Defaults to

#### mode `number`

Sets the entry permissions. Defaults to octal 0664.
Sets the entry permissions. Defaults to octal 0755 (directory) or 0644 (file).

## Libraries

Expand Down
7 changes: 7 additions & 0 deletions lib/modules/core/index.js
Expand Up @@ -45,6 +45,7 @@ Archiver.prototype._normalizeFileData = function(data) {
type: 'file',
name: null,
date: null,
mode: null,
sourcePath: null
});

Expand All @@ -61,6 +62,12 @@ Archiver.prototype._normalizeFileData = function(data) {
}
}

if (typeof data.mode === 'number') {
data.mode &= 0777;
} else {
data.mode = isDir ? 0755 : 0644;
}

data.date = util.dateify(data.date);

return data;
Expand Down

0 comments on commit 07792ad

Please sign in to comment.