node. js supports only single threads, so there is no deadlock, non-blocking I/O mechanism, and event loop mechanism. Ideal for developing applications that need to handle large amounts of concurrent input/output.
A. node. JS has a lot of core modules, here first write a few more commonly used (I personally more commonly used, do not represent the public):
1.buffer: Used to realize the storage and conversion of binary data;
2.child-process: Used to create and manage sub-processes;
3.console: for console output information;
4.events: Used to provide a basic class for event processing;
5.fs: For operating files and file systems;
6.http: For the implementation of HTTP server side and client;
7.https: For the implementation of HTTPS server side and client;
8.path: Used to process file path;
9.string_decoder: Used to implement conversions from binary data to string data;
10.url: Used for parsing and formatting URL strings.
two. node. JS has the following appended classes, functions, and objects that can be used without referencing any modules:
1.buffer class: Used to provide a buffer for the storage of binary data;
2.setTimeout function:
3.clearTimeout function:
4.setInterval function:
5.clearInterval function:
6.require objects: for loading modules;
7.module object: Used to access module information;
8.process object: Used to access process information.
three. REPL
REPL is an interactive runtime environment provided by node. js. Enter the "node" command in the Command Line window and press ENTER to enter the REPL runtime environment, REPL the command prompt in the running environment defaults think ">".
1. In the REPL runtime environment, the most recently used expressions can be accessed by the underscore "_";
2. Basic commands in the REPL runtime environment:
- . Break: When writing a multi-line function halfway to discard or rewrite, the command allows you to return to the command prompt at the beginning of the shortcut key CTRL + C has the same effect;
- . Clear: The variables and functions that are saved in the context object that are used to clear the REPL run environment, in addition,. Clear also has a. break function;
- . Exit: Used to exit the REPL operating environment, can also press two times CTRL + C;
- . Save: Saves all expressions written in the REPL run environment to a file, specifying the path to the file;
- . Load: To load all expressions saved in a file into the REPL runtime environment, you can specify the path of the file;
node. JS Basic Knowledge popularization