rotating-file-stream
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -135,3 +135,3 @@ "use strict"; | ||
tmp.file({ mode: parseInt("777", 8) }, function(err, path, fd, done) { | ||
tmp.file({ keep: true, mode: parseInt("777", 8) }, function(err, path, fd, done) { | ||
if(err) | ||
@@ -138,0 +138,0 @@ return callback(err); |
{ | ||
"name": "rotating-file-stream", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "Opens a stream.Writable to a file rotated by interval and/or size. A logrotate alternative.", | ||
@@ -32,3 +32,3 @@ "scripts": { | ||
"devDependencies": { | ||
"eslint": "3.14.1", | ||
"eslint": "3.15.0", | ||
"istanbul": "0.4.5", | ||
@@ -35,0 +35,0 @@ "mocha-istanbul": "0.3.0", |
@@ -307,2 +307,4 @@ # rotating-file-stream | ||
* 2017-02-07 - v1.1.7 | ||
* fixed tmp.file call | ||
* 2017-02-03 - v1.1.6 | ||
@@ -309,0 +311,0 @@ * eslint |
41
utils.js
@@ -6,2 +6,11 @@ "use strict"; | ||
function buildStringCheck(field, check) { | ||
return function(typ, options, val) { | ||
if(typ !== "string") | ||
throw new Error("Don't know how to handle 'options." + field + "' type: " + typ); | ||
options[field] = check(val); | ||
}; | ||
} | ||
function checkMeasure(v, what, units) { | ||
@@ -36,2 +45,7 @@ var ret = {}; | ||
function checkIntervalUnit(ret, unit, amount) { | ||
if(parseInt(amount / ret.num, 10) * ret.num !== amount) | ||
throw new Error("An integer divider of " + amount + " is expected as " + unit + " for 'options.interval'"); | ||
} | ||
function checkInterval(v) { | ||
@@ -41,15 +55,12 @@ var ret = checkMeasure(v, "interval", intervalUnits); | ||
switch(ret.unit) { | ||
case "m": | ||
if(parseInt(60 / ret.num, 10) * ret.num !== 60) | ||
throw new Error("An integer divider of 60 is expected as minutes for 'options.interval'"); | ||
case "h": | ||
checkIntervalUnit(ret, "hours", 24); | ||
break; | ||
case "h": | ||
if(parseInt(24 / ret.num, 10) * ret.num !== 24) | ||
throw new Error("An integer divider of 24 is expected as hours for 'options.interval'"); | ||
case "m": | ||
checkIntervalUnit(ret, "minutes", 60); | ||
break; | ||
case "s": | ||
if(parseInt(60 / ret.num, 10) * ret.num !== 60) | ||
throw new Error("An integer divider of 60 is expected as seconds for 'options.interval'"); | ||
checkIntervalUnit(ret, "seconds", 60); | ||
break; | ||
@@ -103,9 +114,4 @@ } | ||
"interval": function(typ, options, val) { | ||
if(typ !== "string") | ||
throw new Error("Don't know how to handle 'options.interval' type: " + typ); | ||
"interval": buildStringCheck("interval", checkInterval), | ||
options.interval = checkInterval(val); | ||
}, | ||
"mode": function() {}, | ||
@@ -127,8 +133,3 @@ | ||
"size": function(typ, options, val) { | ||
if(typ !== "string") | ||
throw new Error("Don't know how to handle 'options.size' type: " + typ); | ||
options.size = checkSize(val); | ||
} | ||
"size": buildStringCheck("size", checkSize) | ||
}; | ||
@@ -135,0 +136,0 @@ |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
95719
22
2672
356
19
7