Comparing version
@@ -14,2 +14,3 @@ var inherits = require('util').inherits; | ||
comment: '', | ||
forceUTC: false, | ||
zlib: { | ||
@@ -307,3 +308,3 @@ level: 6 | ||
if (utils.lo.isNumber(file.lastModifiedDate) === false) { | ||
file.lastModifiedDate = utils.convertDateOctal(file.date); | ||
file.lastModifiedDate = utils.dosDateTime(file.date, self.options.forceUTC); | ||
} | ||
@@ -310,0 +311,0 @@ |
@@ -43,16 +43,13 @@ var fs = require('fs'); | ||
utils.convertDateTimeDos = function(input) { | ||
var d = {}; | ||
d.year = (input >> 25) + 1980; | ||
d.month = ((input >> 21) & 0xF) - 1; | ||
d.day = (input >> 16) & 0xF; | ||
d.hour = (input >> 11) & 0xF; | ||
d.minutes = (input >> 5) & 0xF; | ||
d.seconds = (input & 0xF) * 2; | ||
return new Date(d.year, d.month, d.day, d.hour, d.minutes, d.seconds); | ||
return new Date( | ||
((input >> 25) & 0x7f) + 1980, | ||
((input >> 21) & 0x0f) - 1, | ||
(input >> 16) & 0x1f, | ||
(input >> 11) & 0x1f, | ||
(input >> 5) & 0x3f, | ||
(input & 0x1f) << 1); | ||
}; | ||
utils.convertDateTimeOctal = function(input) { | ||
input = parseInt(input, 10) * 1000; | ||
input = parseInt(input, 8) * 1000; | ||
@@ -62,6 +59,7 @@ return new Date(input); | ||
utils.dosDateTime = function(d) { | ||
utils.dosDateTime = function(d, utc) { | ||
d = (d instanceof Date) ? d : new Date(); | ||
utc = utc || false; | ||
var year = d.getFullYear(); | ||
var year = (utc === true) ? d.getUTCFullYear() : d.getFullYear(); | ||
@@ -72,4 +70,13 @@ if (year < 1980) { | ||
return ((year-1980) << 25) | ((d.getMonth()+1) << 21) | (d.getDate() << 16) | | ||
(d.getHours() << 11) | (d.getMinutes() << 5) | (d.getSeconds() >> 1); | ||
var val = { | ||
year: year, | ||
month: (utc === true) ? d.getUTCMonth() : d.getMonth(), | ||
date: (utc === true) ? d.getUTCDate() : d.getDate(), | ||
hours: (utc === true) ? d.getUTCHours() : d.getHours(), | ||
minutes: (utc === true) ? d.getUTCMinutes() : d.getMinutes(), | ||
seconds: (utc === true) ? d.getUTCSeconds() : d.getSeconds() | ||
}; | ||
return ((val.year-1980) << 25) | ((val.month+1) << 21) | (val.date << 16) | | ||
(val.hours << 11) | (val.minutes << 5) | (val.seconds / 2); | ||
}; | ||
@@ -76,0 +83,0 @@ |
{ | ||
"name": "archiver", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Creates Archives (ZIP) via Node Streams.", | ||
@@ -28,3 +28,3 @@ "homepage": "https://github.com/ctalkington/node-archiver", | ||
"scripts": { | ||
"test": "nodeunit --reporter=minimal test/tests.js" | ||
"test": "nodeunit tests" | ||
}, | ||
@@ -31,0 +31,0 @@ "dependencies": { |
@@ -37,2 +37,6 @@ # Archiver [](http://travis-ci.org/ctalkington/node-archiver) | ||
#### forceUTC `boolean` | ||
If true, forces file date and time to UTC. Helps with testing across timezones. | ||
#### zlib `object` | ||
@@ -39,0 +43,0 @@ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41341
7.89%19
11.76%1027
9.37%106
3.92%0
-100%6
20%