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. Node.js 安全指南

    当项目周期快结束时,开发人员会越来越关注应用的"安全性"问题.一个安全的应用程序并不是一种奢侈,而是必要的.你应该在开发的每个阶段都考虑应用程序的安全性,例如系统架构.设计.编码, ...

  2. 使用Spring MVC实现文件上传与下载

    前段时间做毕业设计的时候,想要完成一个上传文件的功能,后来,虽然在自己本地搭建了一个ftp服务器,然后使用公司的工具完成了一个文档管理系统:但是还是没有找到自己想要的文件上传与下载的方式. 今天看到一 ...

  3. Java性能优化,操作系统内核性能调优,JYM优化,Tomcat调优

    文章目录 Java性能优化 尽量在合适的场合使用单例 尽量避免随意使用静态变量 尽量避免过多过常地创建Java对象 尽量使用final修饰符 尽量使用局部变量 尽量处理好包装类型和基本类型两者的使用场 ...

  4. MariaDB数据库---主从复制,galera架构

    主从复制 补充一点:⑤slave端的IO thread 将从master端请求来的二进制日志文件中的内容存储到relay_log(中继日志)中 图片来源:https://www.cnblogs.com ...

  5. jvm系列五-java内存模型初览(1)

    本文转载自:再有人问你Java内存模型是什么,就把这篇文章发给他. 网上有很多关于Java内存模型的文章,在<深入理解Java虚拟机>和<Java并发编程的艺术>等书中也都有关 ...

  6. 分析 BAT 互联网巨头在大数据方向布局及大数据未来发展趋势

    > 风起云涌的大数据战场上,早已迎百花齐放繁荣盛景,各大企业加速跑向"大数据时代".而我们作为大数据的践行者,在这个"多智时代"如何才能跟上大数据的潮流, ...

  7. Codeforces Round #550 (Div. 3) F. Graph Without Long Directed Paths (二分图染色)

    题意:有\(n\)个点和\(m\)条无向边,现在让你给你这\(m\)条边赋方向,但是要满足任意一条边的路径都不能大于\(1\),问是否有满足条件的构造方向,如果有,输出一个二进制串,表示所给的边的方向 ...

  8. Codeforces Round #613 (Div. 2) B. Just Eat It! (DP)

    题意:有一个长度为\(n\)的序列,找出最大的长度不为\(n\)的子段和,问最大子段和是否小于所有元素和. 题解:最大子段和我们可以直接用dp来找,每次状态转移为:\(dp[i]=max(dp[i-1 ...

  9. Educational Codeforces Round 95 (Rated for Div. 2) C. Mortal Kombat Tower (DP)

    题意:你和基友两人从左往右轮流打怪兽,强怪用\(1\)表示,垃圾用\(0\)表示,但基友比较弱,打不过强怪,碰到强怪需要用一次魔法,而你很强,无论什么怪都能乱杀,基友先打,每人每次至少杀一个怪兽,最多 ...

  10. WSL2 准备dotnet core开发环境

    首先我们要知道WSL Ubuntu的版本,以便进行下一步操作: 我的是18.04,所以安装dot net SDK我们参考这里: https://docs.microsoft.com/en-us/dot ...