How is a console large object?

I'm trying to see what the object contains

With the console.log(obj)console disconnects from the lines, and I do not see the whole structure.

Then I tried to write it to a file

fs.writeFile('test', JSON.stringify(obj));

But I get some error about circular links.

Is there any other way to view the lol object? An object is a "connection" to the websocket nodejs module. The docs are very bad and I cannot find a property that contains an IP address :(

+4
source share
4 answers
fs.writeFile('test', JSON.stringify(obj));

But I get some error about circular links.

What happens with JSON. JSON also ignores functions, regular expressions, dates, etc.

util.inspect, , Node console.log() , , :

var util = require('util');
fs.writeFileSync('test.txt', util.inspect(obj));

:

util.inspect(obj, { showHidden: true, depth: null })
+6

dir.

console.dir(obj)
+3

dir,

    console.dir(obj)

;)

+1

console.dir, . , , , , .

- :

var x;
function xyz(){
    // Code
    x = obj;
}

, , x, xyz, , , .

0

All Articles