Reputation: 368
Node in the command line tries to be helpful by previewing the result of a command you're about to run. e.g. if you type 5 + 5
, you'll see 10
appear in the next line down, before you press enter.
This causes huge problems whenever working with large files. If I have some variable foo
that's a 100mb string, if I ever start to type a command like foo = foo.trim()
, upon typing the third character the entire terminal freezes as it tries to render a 100mb string in the preview.
How do I make it stop doing this? I still want it to display the preview for small outputs, but omit or truncate them if they're more than 1000 characters or so. (I want this to be the default, not something I have to redo every time I open a new Node process.)
And a related question: Can I do the same for the command output itself? If I type foo = fs.readFileSync("foo.txt")
, the return value of that line is the file's contents, so node prints the entire file to the terminal, which could freeze it for several minutes. So same as the previews, I'd like Node to not print return values that are overly long.
Upvotes: 1
Views: 27