NAIO & Node.js All In One

Node.js Tutorials

https://nodejs.org/en/docs/

https://nodejs.org/en/docs/guides/

  1. https://nodejs.org/en/docs/guides/#general

    https://nodejs.org/en/docs/guides/getting-started-guide/

  2. https://nodejs.org/en/docs/guides/#node-js-core-concepts

    https://nodejs.org/en/docs/guides/blocking-vs-non-blocking/

  3. https://nodejs.org/en/docs/guides/#module-related-guides

    https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/

node.js tutorials

https://www.w3schools.com/nodejs/

https://www.javatpoint.com/nodejs-tutorial

https://www.tutorialspoint.com/nodejs/

https://stackify.com/learn-nodejs-tutorials/

https://www.codecademy.com/learn/learn-node-js

node.js 教程

https://www.runoob.com/nodejs/nodejs-tutorial.html

https://www.liaoxuefeng.com/wiki/1022910821149312/1023025235359040

https://www.cnblogs.com/chyingp/p/nodejs-learning-guide-github-got-1000-stars.html

https://github.com/chyingp/nodejs-learning-guide

https://nqdeng.github.io/7-days-nodejs/

https://nodejs.jakeyu.top/

https://www.zhihu.com/question/19793473

videos

https://www.imooc.com/course/list?c=nodejs

https://edu.aliyun.com/course/469/lesson/list


node.js & write file & read file

write & read

https://stackoverflow.com/a/15554600/5934465

https://stackoverflow.com/a/2497040/5934465

// preview.js

const fs = require("fs");
const readline = require("readline"); fs.writeFile("file.js", `export const APP_ENV = "preview";`, function(err) {
if(err) {
console.log(err);
return err;
}
let env = "preview";
console.log("The file was saved!", env);
}); let rd = readline.createInterface({
input: fs.createReadStream("file.js"),
output: process.stdout,
console: false
}); rd.on("line", function(line) {
console.log(`line =`, line);
}); // fs.writeFile("file.txt", "prview", function(err) {
// if(err) {
// console.log(err);
// return err;
// }
// console.log("The file was saved!");
// }); // global.APP_ENV = "testing";
// let APP_ENV = global.APP_ENV;
// console.log(`APP_ENV =`, APP_ENV); // let rd = readline.createInterface({
// input: fs.createReadStream('file.txt'),
// output: process.stdout,
// console: false
// }); // rd.on('line', function(line) {
// console.log(`line =`, line);
// });
// testing.js

const fs = require("fs");
const readline = require("readline"); fs.writeFile("file.js", `export const APP_ENV = "testing";`, function(err) {
if(err) {
console.log(err);
return err;
}
let env = "testing";
console.log("The file was saved!", env);
}); // const rl = readline.createInterface({
// input: process.stdin,
// output: process.stdout
// }); // absolute path
// fs.open("/open/some/file.txt", "r", (err, fd) => {
// if (err) {
// throw err;
// }
// fs.close(fd, (err) => {
// if (err) {
// throw err;
// }
// });
// }); // global.APP_ENV = "testing";
// let APP_ENV = global.APP_ENV;
// console.log(`APP_ENV =`, APP_ENV); // relative path
// fs.open("file.js", "r", (err, fd) => {
// if (err) {
// throw err;
// }
// console.log(`fd =`, fd);// 3
// fs.close(fd, (err) => {
// if (err) {
// throw err;
// }
// });
// }); let rd = readline.createInterface({
input: fs.createReadStream("file.js"),
output: process.stdout,
console: false
}); rd.on("line", function(line) {
console.log(`line =`, line);
});
// file.js

export const APP_ENV = "testing";


bash shell

mkdir -p

# mkdir -p /xyz/abc 父级文件夹不存在也可创建
$ mkdir -p /xyz/abc

cli & env runtime

https://www.jikexueyuan.com/course/1332_2.html

cmd

#!/usr/bin/env node

echo "^v^ app is running in production building!" && npm run build

bash

#!/usr/bin/env bash

echo "^v^ app is running in production building!" && npm run build

process.argv

tj & commander.js

https://github.com/tj?tab=repositories

https://github.com/tj/commander.js

https://github.com/xgqfrms/vscode/issues/20

https://github.com/tj/commander.js/blob/master/Readme_zh-CN.md

minimist

https://github.com/substack/minimist

--val

-v & --version

options & help

usage.txt


color

v 1.0.0

colors

https://github.com/xgqfrms-GitHub/Node-CLI-Tools

CLI & CLP

npm link

nvm

强烈建议使用nvm(Node Version Manager) ,nvm是 Nodejs 版本管理器,它让我们方便的对切换Nodejs 版本。

nvm 介绍:使用 nvm 管理不同版本的 node 与 npm


NAIO & Node.js All In One的更多相关文章

  1. node.js学习(三)简单的node程序&&模块简单使用&&commonJS规范&&深入理解模块原理

    一.一个简单的node程序 1.新建一个txt文件 2.修改后缀 修改之后会弹出这个,点击"是" 3.运行test.js 源文件 使用node.js运行之后的. 如果该路径下没有该 ...

  2. 利用Node.js的Net模块实现一个命令行多人聊天室

    1.net模块基本API 要使用Node.js的net模块实现一个命令行聊天室,就必须先了解NET模块的API使用.NET模块API分为两大类:Server和Socket类.工厂方法. Server类 ...

  3. Node.js:进程、子进程与cluster多核处理模块

    1.process对象 process对象就是处理与进程相关信息的全局对象,不需要require引用,且是EventEmitter的实例. 获取进程信息 process对象提供了很多的API来获取当前 ...

  4. Node.js:理解stream

    Stream在node.js中是一个抽象的接口,基于EventEmitter,也是一种Buffer的高级封装,用来处理流数据.流模块便是提供各种API让我们可以很简单的使用Stream. 流分为四种类 ...

  5. Node.js:Buffer浅谈

    Javascript在客户端对于unicode编码的数据操作支持非常友好,但是对二进制数据的处理就不尽人意.Node.js为了能够处理二进制数据或非unicode编码的数据,便设计了Buffer类,该 ...

  6. node.js学习(二)--Node.js控制台(REPL)&&Node.js的基础和语法

    1.1.2 Node.js控制台(REPL) Node.js也有自己的虚拟的运行环境:REPL. 我们可以使用它来执行任何的Node.js或者javascript代码.还可以引入模块和使用文件系统. ...

  7. Node.js npm 详解

    一.npm简介 安装npm请阅读我之前的文章Hello Node中npm安装那一部分,不过只介绍了linux平台,如果是其它平台,有前辈写了更加详细的介绍. npm的全称:Node Package M ...

  8. Node.js入门(一)

    一.Node.js本质上是js的运行环境. 二.可以解析js代码(没有浏览器安全级的限制): 提供系统级的API:1.文件的读写 2.进程的管理 3.网络通信 三.可以关注的四个网站: 1.https ...

  9. Node.js学习笔记——Node.js开发Web后台服务

    一.简介 Node.js 是一个基于Google Chrome V8 引擎的 JavaScript 运行环境.Node.js 使用了一个事件驱动.非阻塞式 I/O 的模型,使其轻量又高效.Node.j ...

随机推荐

  1. 解析MySQL中存储时间日期类型的选择问题

    解析MySQL中存储时间日期类型的选择问题_Mysql_脚本之家 https://www.jb51.net/article/125715.htm 一般应用中,我们用timestamp,datetime ...

  2. 题解 UVA11694 【Gokigen Naname谜题 Gokigen Naname】

    题目 题解 考场上连暴力都不会打的码农题,深搜是真的难 /kk 前置问题 怎么输出"\" cout<<"\\"; 2.怎么处理不在一个环里,可以考虑 ...

  3. 存储型XSS

    DVWA系列(二)存储型XSS https://www.imooc.com/article/284686 网络安全:存储型XSS https://blog.csdn.net/qq_41500251/a ...

  4. 如何手动封装Promise函数

    第一步:Promise构造函数接受一个函数作为参数,该函数的两个参数分别是:resolve和reject; function Promise(task) { // 缓存this let that = ...

  5. 在线工具生成接入信息mqtt.fx快速接入阿里云

    在线工具生成接入信息mqtt.fx快速接入阿里云 在使用阿里云获取的三元组信息进行接入的时候,往往需要加密生成接入信息之后才能进行接入,因此我根据阿里云提供的加密工具实现了一个阿里云物联网平台mqtt ...

  6. 如何使用命令将文件夹中的文件名(包括路径)写入到txt文件中

    在cmd中使用 cd /d 路径,进入当前文件夹中 使用 dir /s /b > 0.txt 如图:

  7. 克鲁斯卡尔算法(Kruskal算法)求最小生成树

    题目传送:https://loj.ac/p/10065 1.排序函数sort,任何一种排序算法都行,下面的示例代码中,我采用的是冒泡排序算法 2.寻源函数getRoot,寻找某一个点在并查集中的根,注 ...

  8. 前n项余数个数和

    一:O(n) 计算贡献:前n项中,能被i(1~n)整除的数的个数为(n/i)个,,也就是 i 给前n项中(n/i)个数做了余数 #include<iostream> using names ...

  9. Educational Codeforces Round 90 (Rated for Div. 2) A. Donut Shops(数学)

    题目链接:https://codeforces.com/contest/1373/problem/A 题意 有两种包装的甜甜圈,第一种 $1$ 个 $a$ 元,第二种 $b$ 个 $c$ 元,问买多少 ...

  10. Java-Graphics类的绘图方法实现

    Java-Graphics(画图类) 就比如画一个矩形,你给出矩形左上角坐标,再给出矩形长度和宽度就可以在JFrame上画出来一个矩形 除了矩形之外,还可以画椭圆.圆.圆弧.线段.多边形.图像等 下面 ...