rotating-file-stream
Advanced tools
Comparing version 1.1.2 to 1.1.3
40
index.js
@@ -15,18 +15,4 @@ "use strict"; | ||
if(! options) | ||
options = {}; | ||
else { | ||
if(typeof options != "object") | ||
throw new Error("Don't know how to handle 'options' type: " + typeof options); | ||
options = utils.checkOptions(options); | ||
var tmp = {}; | ||
for(var i in options) | ||
tmp[i] = options[i]; | ||
options = tmp; | ||
} | ||
utils.checkOptions(options); | ||
if(typeof filename == "function") | ||
@@ -142,2 +128,26 @@ this.generator = filename; | ||
RotatingFileStream.prototype.end = function() { | ||
var args = []; | ||
for(var i in arguments) { | ||
if("function" == typeof arguments[i]) { | ||
this.once("finish", arguments[i]); | ||
break; | ||
} | ||
if(i > 1) | ||
break; | ||
args.push(arguments[i]); | ||
} | ||
this.ending = true; | ||
if(args.length) | ||
this.write.apply(this, args); | ||
else | ||
this._rewrite(); | ||
}; | ||
RotatingFileStream.prototype.firstOpen = function() { | ||
@@ -144,0 +154,0 @@ var self = this; |
{ | ||
"name": "rotating-file-stream", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Opens a stream.Writable to a file rotated by interval and/or size. A logrotate alternative.", | ||
@@ -11,3 +11,3 @@ "engines": { | ||
"jshint": "./node_modules/.bin/jshint *.js test", | ||
"npmignore": "echo '.jshintrc\\n.gitignore\\n.travis.yml\\ntest\\nsleep.js' > .npmignore ; cat .gitignore >> .npmignore", | ||
"npmignore": "echo '.gitignore\\n.jshintrc\\n.travis.yml\\nsleep.js\\ntest' > .npmignore ; cat .gitignore >> .npmignore", | ||
"t": "./node_modules/.bin/_mocha test", | ||
@@ -14,0 +14,0 @@ "test": "npm run npmignore && npm run jshint && npm run coverage" |
22
utils.js
@@ -132,2 +132,10 @@ "use strict"; | ||
function checkOptions(options) { | ||
if(! options) | ||
return {}; | ||
if(typeof options != "object") | ||
throw new Error("Don't know how to handle 'options' type: " + typeof options); | ||
var ret = {}; | ||
for(var opt in options) { | ||
@@ -140,4 +148,7 @@ var val = options[opt]; | ||
checks[opt](typ, options, val); | ||
ret[opt] = options[opt]; | ||
checks[opt](typ, ret, val); | ||
} | ||
return ret; | ||
} | ||
@@ -199,11 +210,2 @@ | ||
}); | ||
self.end = function(chunk, encoding, callback) { | ||
self.ending = true; | ||
if(chunk) | ||
self.write(chunk, encoding, callback); | ||
else | ||
self._rewrite(); | ||
}; | ||
} | ||
@@ -210,0 +212,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
613
18295
6
1
0