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. .htaccess 和 .user.ini

    .htaccess 仅能用于apache下,并且内容严格,不能有错误行,如:GIF89a .user.ini php 5.3.0开始引入,可设置除了:PHP_INI_SYSTEM 外的其他,包括(PH ...

  2. Spring Boot中的静态资源文件

    Spring Boot中的静态资源文件 1.SSM中的配置 2.Spring Boot 中的配置 2.1 整体规划 2.2 源码解读 2.3 自定义配置 2.3.1 application.prope ...

  3. REST架构及其介绍

    概述     REST是英文Representational State Transfer的缩写,中文翻译:表述性状态转移.     他是由Roy Thomas Fielding博士在他的论文 < ...

  4. (30)Linux文本处理

    1.cat命令:连接文件并打印输出到标准输出设备 cat 命令可以用来显示文本文件的内容(类似于 DOS 下的 type 命令),也可以把几个文件内容附加到另一个文件中,即连接合并文件. cat 命令 ...

  5. 数理统计4:均匀分布的参数估计,次序统计量的分布,Beta分布

    接下来我们就对除了正态分布以外的常用参数分布族进行参数估计,具体对连续型分布有指数分布.均匀分布,对离散型分布有二项分布.泊松分布几何分布. 今天的主要内容是均匀分布的参数估计,内容比较简单,读者应尝 ...

  6. NodeRED - 全局变量的使用笔记

    NodeRED - 全局变量的使用笔记 global global.get(..) :获取全局范围的上下文属性 global.set(..) :设置全局范围的上下文属性 global.keys(..) ...

  7. Flink-v1.12官方网站翻译-P018-Event Time

    事件时间 在本节中,您将学习如何编写时间感知的Flink程序.请看一下及时流处理,了解及时流处理背后的概念. 关于如何在Flink程序中使用时间的信息请参考windowing和ProcessFunct ...

  8. Pokémon Army (easy version) CodeForces - 1420C1 dp

    题意: 给你一个长度为n个序列v,你需要从中找一个子序列.这个子序列的值等于:子序列中奇数下标的值-偶数下标的值 你需要使得这个值尽可能大,让你输出这个最大值 题解: dp[i][0]表示:在原序列从 ...

  9. AtCoder Beginner Contest 184 E - Third Avenue (BFS)

    题意:给你一张图,\(S\)表示起点,\(G\)表示终点,\(.\)表示可以走,#表示不能走,小写字母可以传送到任意一个相同的字母的位置,问从\(S\)走到\(G\)的最小步数. 题解:假如不考虑字母 ...

  10. Codeforces Round #501 (Div. 3) B. Obtaining the String (思维,字符串)

    题意:有两个字符串\(S\)和\(T\),判断\(T\)是否能由\(S\)通过交换某位置的相邻字符得到,如果满足,输出交换次数及每次交换的位置,否则输出\(-1\). 题解:首先判断不满足的情况,只有 ...