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. Uber三代API 生命周期管理平台实现 Uber

    Uber三代API 生命周期管理平台实现 - InfoQ https://www.infoq.cn/article/H8Ml6L7vJGQz0efpWvyJ Uber 三代 API 生命周期管理平台实 ...

  2. smtplib.py

    def _print_debug(self, *args): if self.debuglevel > 1: print(datetime.datetime.now().time(), *arg ...

  3. go 语言开发中 GOPATH问题 与 go语言linux 开发环境 教程

    https://github.com/rubyhan1314/Golang-100-Days/blob/master/Day01-15(Go%E8%AF%AD%E8%A8%80%E5%9F%BA%E7 ...

  4. 后台故障&性能分析常用工具

    说明 本文是一个归纳总结,把常用的一些指令,及它们常用的option简单记录了一下,目的是当我们需要工具去定位问题的时候,能够从中找到合适的工具,具体的用法网上有很多博文了,当然还有man手册.参考了 ...

  5. 网络流 - dinic + 当前弧优化【代码】

    这是初学网络流的时候从<算法竞赛进阶指南>抄下来的一份代码,自己理解的也不是很透彻. 注意,边要从 \(1\) 开始计,不然直接 \(xor\) 运算的话取反边会直接炸掉. #includ ...

  6. 在项目中如何自定义的Eslint配置

    一.设置js风格的缩进为4个空格 在你的前端项目中找到.eslintrc.js文件,如图 module.exports = { root: true, parserOptions: { parser: ...

  7. MySQL按照(windows)及常用命令

    MySQL语法规则 关键字与函数名称全部大写 数据库名称.表名称.字段名称全部小写 SQL 语句必须以分号结尾 MySQL安装 MySQL配置: 在cmd中输入 mysql,提示['mysql' 不是 ...

  8. Spring Boot 整合 Freemarker

    Spring Boot 整合 Freemarker 1.Freemarker 简介 2.Spring Boot 整合 Freemarker 2.1 创建工程 2.2 创建类 2.3 其他配置 原文地址 ...

  9. form(form基础、标签渲染、错误显示 重置信息、form属性、局部钩子、全局钩子)

    form基础 Django中的Form使用时一般有两种功能: 1.生成html标签 2.验证输入内容 要想使用django提供的form,要在views里导入form模块 from django im ...

  10. Cobaltstrike去除特征

    出品|MS08067实验室(www.ms08067.com) 本文作者:BlackCat(Ms08067实验室内网小组成员) 前言: 红蓝对抗的时候,如果未修改CS特征.容易被蓝队溯源. 去特征的几种 ...