NodeJS: Difference between revisions

10 bytes added ,  7 October 2019
Line 17: Line 17:
</syntaxhighlight>
</syntaxhighlight>


=Usage=
==Usage==
JavaScript files can be run directly using <code>node index.js</code>
JavaScript files can be run directly using <code>node index.js</code>
==Filesystem Access==
===Filesystem Access===
Install [https://www.npmjs.com/package/fs-extra fs-extra] to your project.
Install [https://www.npmjs.com/package/fs-extra fs-extra] to your project.
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
Line 52: Line 52:
</syntaxhighlight>
</syntaxhighlight>


==Logging==
===Logging===
Mostly the same as web JavaScript.<br>
Mostly the same as web JavaScript.<br>
[https://nodejs.org/api/console.html Reference]
[https://nodejs.org/api/console.html Reference]
Line 61: Line 61:
</syntaxhighlight>
</syntaxhighlight>


==CSV==
===CSV===
Install csv from npm.<br>
Install csv from npm.<br>
[https://csv.js.org/parse/api/ Reference]
[https://csv.js.org/parse/api/ Reference]
Line 68: Line 68:




==Running other processes==
===Running other processes===
You can invoke other processes or CLI programs using <code>spawn</code> or <code>spawnSync</code>
You can invoke other processes or CLI programs using <code>spawn</code> or <code>spawnSync</code>
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">