Some pure Node demo
use inquirer-search-list and inquirer to archive auto complete in cli.
Use crawler to get network content.
A simple daemon process
- Create a child process
- Create a new session in the child process (call system function setsid)
- Change the subprocess working directory (eg: "/" or "/usr/, etc.)
- Parent process termination
Using spawn to create a child process completes the first step above.
Setting options.detached to true causes the child process to continue running after the parent process exits, which is the second step.
Options.cwd specifies the current child process working directory.
If you do not set the default to inherit the current working directory, this is the third step.
Run daemon.unref() to exit the parent process, refer to options.stdio, which is the fourth step.
$ npm run demo:daemonlog will be write into ./daemon/stdout.log
Start multiple processes on the same port
$ npm run demo:fork_multiProcess_samePortonly one process started, and other cpu's lengths process is error:
Use handle such as TCP socket, UDP and so on to solve this problem.
$ npm run demo:fork_multiProcess_samePort:trueorphan process
$ worker process created, pid: 77815 ppid: 77814it's fathers ppid is 1:
use of node-graphviz
communication bewteen two process with pipe
$ npm run demo:ipc_pipe 81160 81161
I am worker, PID: 81161
use yorkie/husky + lint-staged + prettier to format code after commit automatic
read and write json file
Promise achieve based on promise/A+
single design pattern in node, by cache of module.
usage of vm2


