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

fh-reportingclient

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fh-reportingclient - npm Package Compare versions

Comparing version 0.1.1 to 0.2.1

.idea/libraries/sass_stdlib.xml

35

lib/fh-reporting.js

@@ -5,3 +5,7 @@ var request = require('request');

var crypto = require('crypto');
var backUpFileStream;
var recoveryFileStream;
exports.Reporting = Reporting;

@@ -92,7 +96,30 @@

};
//note backUpFileStream and recoveryFileStream are singletons and are only created once per application lifecycle.
//this is to address the problem of having too many file handles open ticket
Reporting.prototype.saveToFile = function (filepath, msg, cb) {
var stream;
var fileFlags = {flags:'a'};
if(this.config.backupFiles && filepath === this.config.backupFiles.fileName){
if(! backUpFileStream){
backUpFileStream = fs.createWriteStream(filepath,fileFlags);
}
stream = backUpFileStream;
}else if (this.config.recoveryFiles && filepath === this.config.recoveryFiles.fileName){
if(! recoveryFileStream){
recoveryFileStream = fs.createWriteStream(filepath,fileFlags);
}
stream = recoveryFileStream;
}else if(filepath){
//fallback to creating a write stream and destroying it?
var tempStream = fs.createWriteStream(filepath , fileFlags);
tempStream.write(JSON.stringify(msg) + "\n");
tempStream.destroySoon();
}
if(stream){
stream.write(JSON.stringify(msg) + "\n");
stream.on('error', function (err){
cb(err);
});
}
Reporting.prototype.saveToFile = function (filepath, msg, cb) {
var s = fs.createWriteStream(filepath, {flags:'a'});
s.write(JSON.stringify(msg) + "\n");
s.destroySoon();
if (cb) {

@@ -99,0 +126,0 @@ process.nextTick(cb);

2

package.json

@@ -6,3 +6,3 @@ {

"description": "FH Reporting Client",
"version": "0.1.1",
"version": "0.2.1",
"directories":{

@@ -9,0 +9,0 @@ "lib": "./lib"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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