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. Python_1生成器(下)之单线并行--生产着消费者模型

    1 import time 2 def consumer(name): 3 print('%s准备吃包子了!' %name) 4 while True: 5 baozi = yield 6 print ...

  2. Buffer Data RDMA 零拷贝 直接内存访问

    waylau/netty-4-user-guide: Chinese translation of Netty 4.x User Guide. 中文翻译<Netty 4.x 用户指南> h ...

  3. TCP介绍

    TCP协议,传输控制协议(英语:Transmission Control Protocol,缩写为 TCP)是一种面向连接的.可靠的.基于字节流的传输层通信协议,由IETF的RFC 793定义. TC ...

  4. P1837 单人纸牌

    写在前面 感谢巨佬 yu__xuan 的帮助! 原本题解区的大佬们大都写的九层循环,其实此题如果写成状压,可以将这九层循环写成一层,非但简洁.代码可读性强,常数也比直接九维 dp 小. 算法思路 由于 ...

  5. Javascript 基础知识整理

    Javascript的作用 表单验证,减轻服务器压力 添加页面动画效果 动态更改页面内容 Ajax网络请求(异步加载数据) -它属于前端的核心,主要用来控制和重新调整DOM,通过修改DOM结构,从而达 ...

  6. Jenkins安装部署项目

    Jenkins安装部署项目 配置JDK git maven 部署到服务器 一.新建任务 二.配置jenkins 三.添加构建信息 四.应用.保存 五.踩坑填坑记录 5.1没有jar包的情况 5.2无法 ...

  7. hadoop知识点总结(二)hdfs分布式文件系统

    1, hdfs设计:减少硬件错误的危害,流式数据访问,大规模数据集,简单的一致性模型 2,特点: 1)移动计算的代价比移动数据的代价低 在异构的软硬件平台间的可移植性 2)局限性 不适合低延迟性数据访 ...

  8. UML——交互图(序列图+协作图)

    交互图(interaction diagram):是协作图=通信图UML2.0以后的叫法=合作图=(Collaboration /Communication Diagram)以及序列图=顺序图=时序图 ...

  9. c++11新特性实战(二):智能指针

    c++11添加了新的智能指针,unique_ptr.shared_ptr和weak_ptr,同时也将auto_ptr置为废弃(deprecated). 但是在实际的使用过程中,很多人都会有这样的问题: ...

  10. k8s~kubectl常用命令

    查看所有 pod 列表, -n 后跟 namespace, 查看指定的命名空间 kubectl get pod kubectl get pod -n kube kubectl get pod -o w ...