bin/save-trace.js
function handlePost(req, res) {
  var length = parseInt(req.headers['content-length'], 10);
  if (length <= 0) {
    res.end();
    return;
  }

  var filename = req.headers['x-filename'] || 'save-trace.wtf-trace';
  var writable = fs.createWriteStream(filename, {flags: 'w'});

  req.on('data', function(chunk) {
    writable.write(chunk);
  });

  req.on('end', function() {
    console.log(filename);
    writable.end();
    res.end();
  });
}
function handlePost(req, res) {
  var length = parseInt(req.headers['content-length'], 10);
  if (length <= 0) {
    res.end();
    return;
  }

  var filename = req.headers['x-filename'] || 'save-trace.wtf-trace';
  var writable = fs.createWriteStream(filename, {flags: 'w'});

  req.on('data', function(chunk) {
    writable.write(chunk);
  });

  req.on('end', function() {
    console.log(filename);
    writable.end();
    res.end();
  });
}
function handlePost ( req , res ) { var length = parseInt ( req . headers [ 'content-length' ] , 10 ) ; if ( length <= 0 ) { res . end ( ) ; return ; } var filename = req . headers [ 'x-filename' ] || 'save-trace.wtf-trace' ; var writable = fs . createWriteStream ( filename , { flags : 'w' } ) ; req . on ( 'data' , function ( chunk ) { writable . write ( chunk ) ; } ) ; req . on ( 'end' , function ( ) { console . log ( filename ) ; writable . end ( ) ; res . end ( ) ; } ) ; }
Save the posted trace file to local directory.
Save the posted trace file to local directory .