-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Implemented Snapshot.export
#58
Conversation
Looks nice after quick review and should solve the problem I was trying to tackle in #55. |
I'd say the solution is overcomplicated, it should be enough to support the flavour |
@bajtos , are you propose to return |
Yes and yes. See concat-stream for an example of converting a stream-based interface to a callback-based one. |
Code sample: var callback = function(err, data) { /*...*/ };
var concatStream = require('concat-stream')(function(data) { callback(null, data); });
profiler.takeSnapshot().export()
.on('error', callback)
.pipe(concatStream)
.on('error', callback); |
Also |
I take var fs = require('fs') ;
profiler.gc().takeSnapshot().export() // We don't need to keep snapshot in memory
.pipe(fs.createWriteStream('snapshot1'))
.on('finish', profiler.gc)
.on('finish', function test() {
// Do something here.
//...
compareHeapState();
});
function compareHeapState() {
var currentHeap = profiler.takeSnapshot(),
startHeap = profiler.import.snapshot('snapshot1');
return currentHeap.compare(startHeap);
} Of course we don't have |
d8da5e6
to
1a24629
Compare
@3y3 are you moving forwards with this? |
Landed. |
For @thlorenz review.