Skip to content

Commit 9e4b0f2

Browse files
committed
remove octal literals. closes #28
1 parent 006d5fa commit 9e4b0f2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ zipfile.outputStream.pipe(fs.createWriteStream("output.zip")).on("close", functi
2929
// alternate apis for adding files:
3030
zipfile.addReadStream(process.stdin, "stdin.txt", {
3131
mtime: new Date(),
32-
mode: 0100664, // -rw-rw-r--
32+
mode: parseInt("0100664", 8), // -rw-rw-r--
3333
});
3434
zipfile.addBuffer(new Buffer("hello"), "hello.txt", {
3535
mtime: new Date(),
36-
mode: 0100664, // -rw-rw-r--
36+
mode: parseInt("0100664", 8), // -rw-rw-r--
3737
});
3838
// call end() after all the files have been added
3939
zipfile.end();
@@ -324,6 +324,8 @@ In order to create empty directories, use `addEmptyDirectory()`.
324324

325325
## Change History
326326

327+
* 2.4.2
328+
* Remove octal literals to make yazl compatible with strict mode. [pull #28](https://github.com/thejoshwolfe/yazl/pull/28)
327329
* 2.4.1
328330
* Fix Mac Archive Utility compatibility issue. [issue #24](https://github.com/thejoshwolfe/yazl/issues/24)
329331
* 2.4.0

index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@ function validateMetadataPath(metadataPath, isDirectory) {
360360
return metadataPath;
361361
}
362362

363+
var defaultFileMode = parseInt("0100664", 8);
364+
var defaultDirectoryMode = parseInt("040775", 8);
365+
363366
// this class is not part of the public API
364367
function Entry(metadataPath, isDirectory, options) {
365368
this.utf8FileName = new Buffer(metadataPath);
@@ -370,7 +373,7 @@ function Entry(metadataPath, isDirectory, options) {
370373
if (options.mode != null) {
371374
this.setFileAttributesMode(options.mode);
372375
} else {
373-
this.setFileAttributesMode(isDirectory ? 040775 : 0100664);
376+
this.setFileAttributesMode(isDirectory ? defaultDirectoryMode : defaultFileMode);
374377
}
375378
if (isDirectory) {
376379
this.crcAndFileSizeKnown = true;

0 commit comments

Comments
 (0)