NAIO & Node.js All In One
NAIO & Node.js All In One
Node.js Tutorials
https://nodejs.org/en/docs/
https://nodejs.org/en/docs/guides/
https://nodejs.org/en/docs/guides/#general
https://nodejs.org/en/docs/guides/getting-started-guide/https://nodejs.org/en/docs/guides/#node-js-core-concepts
https://nodejs.org/en/docs/guides/blocking-vs-non-blocking/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的更多相关文章
- node.js学习(三)简单的node程序&&模块简单使用&&commonJS规范&&深入理解模块原理
一.一个简单的node程序 1.新建一个txt文件 2.修改后缀 修改之后会弹出这个,点击"是" 3.运行test.js 源文件 使用node.js运行之后的. 如果该路径下没有该 ...
- 利用Node.js的Net模块实现一个命令行多人聊天室
1.net模块基本API 要使用Node.js的net模块实现一个命令行聊天室,就必须先了解NET模块的API使用.NET模块API分为两大类:Server和Socket类.工厂方法. Server类 ...
- Node.js:进程、子进程与cluster多核处理模块
1.process对象 process对象就是处理与进程相关信息的全局对象,不需要require引用,且是EventEmitter的实例. 获取进程信息 process对象提供了很多的API来获取当前 ...
- Node.js:理解stream
Stream在node.js中是一个抽象的接口,基于EventEmitter,也是一种Buffer的高级封装,用来处理流数据.流模块便是提供各种API让我们可以很简单的使用Stream. 流分为四种类 ...
- Node.js:Buffer浅谈
Javascript在客户端对于unicode编码的数据操作支持非常友好,但是对二进制数据的处理就不尽人意.Node.js为了能够处理二进制数据或非unicode编码的数据,便设计了Buffer类,该 ...
- node.js学习(二)--Node.js控制台(REPL)&&Node.js的基础和语法
1.1.2 Node.js控制台(REPL) Node.js也有自己的虚拟的运行环境:REPL. 我们可以使用它来执行任何的Node.js或者javascript代码.还可以引入模块和使用文件系统. ...
- Node.js npm 详解
一.npm简介 安装npm请阅读我之前的文章Hello Node中npm安装那一部分,不过只介绍了linux平台,如果是其它平台,有前辈写了更加详细的介绍. npm的全称:Node Package M ...
- Node.js入门(一)
一.Node.js本质上是js的运行环境. 二.可以解析js代码(没有浏览器安全级的限制): 提供系统级的API:1.文件的读写 2.进程的管理 3.网络通信 三.可以关注的四个网站: 1.https ...
- Node.js学习笔记——Node.js开发Web后台服务
一.简介 Node.js 是一个基于Google Chrome V8 引擎的 JavaScript 运行环境.Node.js 使用了一个事件驱动.非阻塞式 I/O 的模型,使其轻量又高效.Node.j ...
随机推荐
- 【LinuxShell】ps 命令浅析
前言 Linux上查看进程状态最常用的命令,本文对 ps 命令参数以及状态做一下简单介绍. 参数 ps a 显示现行终端机下的所有程序,包括其他用户的程序. ps -A 显示所有程序. ps c 列出 ...
- C++ Primer Plus读书笔记(十)对象和类
1.类 不废话,上定义 class ClassName { public: xxx; private: xxx; protected: xxx; } private部分数据只能通过public 提供的 ...
- Flink-v1.12官方网站翻译-P019-Generating Watermarks
生成水印 在本节中,您将了解 Flink 提供的 API,用于处理事件时间时间戳和水印.关于事件时间.处理时间和摄取时间的介绍,请参考事件时间的介绍. 水印策略介绍 为了使用事件时间,Flink需要知 ...
- yum.repos.d中的变量($releasever与$basearch)
今天打算更新一下centos的repo源,把原先国外的repo地址换成国内的,速度快一些.主要替换的文件是/etc/yum.repos.d/Centos-Base.repo .替换的时候,不知道大家有 ...
- 小心 Enum Parse 中的坑
小心 Enum Parse 中的坑 Intro 最近使用枚举的时候,踩了一个小坑,分享一下,主要是枚举从 int 值转成枚举时可能会遇到 Sample 来看下面的示例: 首先定义一个枚举: publi ...
- httprunner(4)录制生成测试用例
前言 写用例之前,我们应该熟悉API的详细信息.建议使用抓包工具Charles或AnyProxy进行抓包. har2case 我们先来了解一下另一个项目har2case 他的工作原理就是将当前主流的抓 ...
- 2020牛客暑期多校训练营(第一场)Easy Integration
传送门:J. Easy Integration 题意:给你n,求这个积分,最后的结果分子是记为p,分母记为q. 求(p*q-1)mod 998244353. 题解:比赛完看到巨巨说这是贝塔函数,我一搜 ...
- Codeforces 1355 E. Restorer Distance(三分)
传送门:E - Restorer Distance 题意:给出四个数 N, A, R, M ,然后给出一个长度为N的序列.让一个数+1花费A,-1花费R,从一个大的数向一个小的数移动1花费M.问让所 ...
- Educational Codeforces Round 84 E. Count The Blocks
传送门: 1327- E. Count The Blocks 题意:给你一个整数n,求10^n内(每个数有前导零)长度为1到n的块分别有多少个.块的含义是连续相同数字的长度. 题解:从n=1开始枚举 ...
- codeforces 580D. Kefa and Dishes
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...