Skip to content

Instantly share code, notes, and snippets.

@morganrallen
Created September 6, 2015 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morganrallen/32f382ba21d7da21be5f to your computer and use it in GitHub Desktop.
Save morganrallen/32f382ba21d7da21be5f to your computer and use it in GitHub Desktop.
var fs = require("fs");
var ws = fs.createWriteStream("0xbfc40000-0xbffffff0-scaled.log");
var rs = fs.createReadStream("0xbfc40000-0xbffffff0.log");
var line = 0;
function tohex(n) {
var out = n.toString(16);
return out;
}
rs.on("error", console.log.bind(console));
rs.on("data", function(data) {
line += 16;
ws.write(data.toString().replace(/......../, tohex(line)));
});
rs.on("end", function() {
console.log(line);
ws.end();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment