Comparing version 1.0.2 to 1.0.3
#!/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
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
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
24079
8
93