Skip to content
Advertisement

How to save the output of a console.log(object) to a file?

I tried using JSON.stringify(object), but it doesn’t go down on the whole structure and hierarchy.

On the other hand console.log(object) does that but I cannot save it.

In the console.log output I can expand one by one all the children and select and copy/paste but the structure is to big for that.

Advertisement

Answer

Update: You can now just right click

Right click > Save as in the Console panel to save the logged messages to a file.

Original Answer:

You can use this devtools snippet shown below to create a console.save method. It creates a FileBlob from the input, and then automatically downloads it.

JavaScript

Source: http://bgrins.github.io/devtools-snippets/#console-save

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement