learn
learn

Reputation: 51

In visual studio code console log does not print raw data but in terminal works?

enter image description here

  var fs = require('fs');

  fs.readFile(process.argv[1], function callBack(err, data){
      if(err){
        return;
      }
      console.log('raw data ::', data);
      console.log('string ::', data.toString());
  })

Output does not even print 'raw data ::' line.

Upvotes: 1

Views: 10200

Answers (1)

Shalitha Suranga
Shalitha Suranga

Reputation: 1146

You can debug with external terminal by configuring launch.json (You need to place your file inside a folder to do configuration)

Go to Debug -> Open Configurations

Add "console": "externalTerminal" to your launch.json

Example edited file

"version": "0.2.0",
"configurations": [
    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${workspaceFolder}/t.js",
        "console": "externalTerminal"
    }
]

Try Debugging. VsCode will debug your output on separate terminal

Hope it helped you.

Upvotes: 2

Related Questions