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

heapware

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heapware - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

cli.js

63

my-middleware.js
#!/usr/bin/env node
var fs = require('fs');
var filePath = 'heapdump.json';
var heapdump = require('heapdump');
var nodereport = require('node-report/api');
var nodereport = require('node-report');
var jsonfile = require('jsonfile');
var json = require('json-update');
var at = require('yargs')
.command('Process','Enter heap or report',{
pro:{
describe : 'Process to run',
alias: 'p'
}
})
.command('Loops', 'Number of times the heapdump or node report',{
lo:{
describe: 'Number of times',
alias: 'l'
}
})
.command('Set Intervals', 'Enter the interval for heapdumbs',{
du: {
describe: 'Set Interval',
alias: 'd'
}
})
.command('FilePath','Enter path',{
filepath:{
describe : 'eg /tmp/',
alias: 'f'
}
})
.help()
.argv;
var filePathd = at.filepath+'data.json';
var filePath = at.filepath;
var obj = {
"type": at.pro,
"nTimes": at.lo,
"nIntervals": at.du
}
json.update(filePathd,obj)
.then(function(dat) {
});
fs.watchFile(filePathd, function(event, filename) {
fs.watchFile(filePath, function(event, filename) {
if(filename){
try{
file = fs.readFileSync(filePathd);
jsonfile.readFile(filePathd, function(err, obj) {
file = fs.readFileSync(filePath);
jsonfile.readFile(filePath, function(err, obj) {
console.dir(obj.type);

@@ -59,3 +18,3 @@ if(obj.type == 'heap'){

for (var i = 0; i < obj.nTimes ; i++){
setTimeout(generateHeapDumpAndStats, obj.nIntervals);}
setTimeout(function() {generateHeapDumpAndStats();}, obj.nIntervals);}

@@ -65,3 +24,3 @@ }

nodereport.setFileName("myreport" +Date.now() +"taken ");
nodereport.setDirectory(filePath);
nodereport.setDirectory('./');
nodereport.triggerReport();

@@ -86,8 +45,8 @@ console.log('take report');

console.log('Took heapdump');
heapdump.writeSnapshot(filePath+'foo' + Date.now() + '.heapsnapshot');
heapdump.writeSnapshot('/Users/ssjain/WebstormProjects/untitled1/foo' + Date.now() + '.heapsnapshot');
}
///Users/ssjain/WebstormProjects/untitled1
module.exports = function() {
return function(req, res, next) {
console.log('Hello World')// Implement the middleware function based on the options object
next()

@@ -97,1 +56,3 @@ }

{
"name": "heapware",
"version": "1.0.2",
"version": "1.0.3",
"description": "trigger and export heap dumps",

@@ -5,0 +5,0 @@ "main": "my-middleware.js",

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