node-study
Intro of node
Install&& Use
Use nvm to manage the node version
Use node index.js
to run single script
Node file system
Use fs.writeFile(file,data)
to write to a file and
fs.readFile()` to read from a file. need to require fs first.
1 | const fs = require('fs'); |
NPM
use npm init
to init a npm project
When using the functions in the package normally it needs to use
var xxx = require("xxxxx")
. But using ECMAScript Modules
we can use import xxx from "xxxxx"
. You need to add
"type": "module",
in package.json file in order to use
import.