Created
August 30, 2017 20:01
-
-
Save gdoteof/961898819e85af82e92896d8ce327c6e to your computer and use it in GitHub Desktop.
viewing large javascript objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var exec = require('child_process').exec; | |
function inspect(object, filename) { | |
var html = "<script>var j = " + JSON.stringify(object) + "; console.log(j);</script> open console"; | |
var tmpFile = (filename) ? filename : "/tmp/inspect.html"; | |
fs.writeFileSync(tmpFile, html) | |
exec("open " + tmpFile); | |
} | |
module.exports = inspect; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment