Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rotating-file-stream

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rotating-file-stream - npm Package Compare versions

Comparing version 0.0.5 to 0.1.0

38

compress.js

@@ -7,2 +7,3 @@ "use strict";

var utils = require("./utils");
var zlib = require("zlib");

@@ -14,12 +15,25 @@ function compress(callback, tmp) {

if(err)
return callback(name, err);
return callback(null, err);
self.touch(name, function(err) {
if(err)
return callback(name, err);
return callback(null, err);
var done = function(err) {
if(err)
return callback(name, err);
fs.unlink(tmp, callback.bind(null, name));
};
if(typeof self.options.compress == "function")
self.external(tmp, name, callback.bind(null, name));
self.external(tmp, name, done);
else
throw new Error("Not implemented yet");
self.gzip(tmp, name, done);
/*
if(self.options.compress == "gzip")
self.gzip(tmp, name, done);
else
throw new Error("Not implemented yet");
*/
});

@@ -87,2 +101,17 @@ });

function gzip(src, dst, callback) {
var inp = fs.createReadStream(src);
var out = fs.createWriteStream(dst);
var zip = zlib.createGzip();
var files = [inp, out, zip];
for(var i in files)
files[i].once("error", callback);
out.once("finish", callback);
inp.pipe(zip).pipe(out);
}
function touch(name, callback, retry) {

@@ -111,3 +140,4 @@ var self = this;

findName: findName,
gzip: gzip,
touch: touch
};

4

package.json
{
"name": "rotating-file-stream",
"version": "0.0.5",
"version": "0.1.0",
"description": "Opens a stream.Writable to a file rotated by interval and/or size. A logrotate alternative.",

@@ -32,3 +32,3 @@ "engines": {

"devDependencies": {
"istanbul": "0.3.21",
"istanbul": "0.3.22",
"jshint": "2.8.0",

@@ -35,0 +35,0 @@ "mocha": "2.3.3",

@@ -24,8 +24,2 @@ # rotating-file-stream

# under development
__This package is currently under development.__
Please check the [TODO list](#todo) to be aware of what is missing.
### Installation

@@ -161,3 +155,2 @@

Following fixed strings are allowed to compress the files with internal libraries:
* bzip
* gzip

@@ -266,9 +259,6 @@

### TODO
* Internal compression gzip
* Internal compression bzip
### ChangeLog
* 2015-10-07 - v0.1.0
* Internal gzip compression
* 2015-10-06 - v0.0.5

@@ -275,0 +265,0 @@ * External compression

@@ -89,3 +89,4 @@ "use strict";

if(typ == "string") {
if(val != "bzip" && val != "gzip")
//if(val != "bzip" && val != "gzip")
if(val != "gzip")
throw new Error("Don't know how to handle compression method: " + val);

@@ -92,0 +93,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc