linfeimy / node.js-demo Goto Github PK
View Code? Open in Web Editor NEWNode.js相关学习记录
Node.js相关学习记录
const querystring = require('querystring');
console.log(querystring);
{
unescapeBuffer: [Function: unescapeBuffer],
unescape: [Function: qsUnescape],
escape: [Function: qsEscape],
stringify: [Function: stringify],
encode: [Function: stringify],
parse: [Function: parse],
decode: [Function: parse]
}
const http = require('http');
console.log(http);
{
_connectionListener: [Function: connectionListener],
METHODS: ['ACL', 'BIND', 'CHECKOUT', 'CONNECT', 'COPY', 'DELETE', 'GET', 'HEAD', 'LINK', 'LOCK', 'M-SEARCH', 'MERGE', 'MKACTIVITY', 'MKCALENDAR', 'MKCOL', 'MOVE', 'NOTIFY', 'OPTIONS', 'PATCH', 'POST', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT', 'REBIND', 'REPORT', 'SEARCH', 'SOURCE', 'SUBSCRIBE', 'TRACE', 'UNBIND', 'UNLINK', 'UNLOCK', 'UNSUBSCRIBE'],
STATUS_CODES: {
'100': 'Continue',
'101': 'Switching Protocols',
'102': 'Processing',
'103': 'Early Hints',
'200': 'OK',
'201': 'Created',
'202': 'Accepted',
'203': 'Non-Authoritative Information',
'204': 'No Content',
'205': 'Reset Content',
'206': 'Partial Content',
'207': 'Multi-Status',
'208': 'Already Reported',
'226': 'IM Used',
'300': 'Multiple Choices',
'301': 'Moved Permanently',
'302': 'Found',
'303': 'See Other',
'304': 'Not Modified',
'305': 'Use Proxy',
'307': 'Temporary Redirect',
'308': 'Permanent Redirect',
'400': 'Bad Request',
'401': 'Unauthorized',
'402': 'Payment Required',
'403': 'Forbidden',
'404': 'Not Found',
'405': 'Method Not Allowed',
'406': 'Not Acceptable',
'407': 'Proxy Authentication Required',
'408': 'Request Timeout',
'409': 'Conflict',
'410': 'Gone',
'411': 'Length Required',
'412': 'Precondition Failed',
'413': 'Payload Too Large',
'414': 'URI Too Long',
'415': 'Unsupported Media Type',
'416': 'Range Not Satisfiable',
'417': 'Expectation Failed',
'418': 'I\'m a Teapot',
'421': 'Misdirected Request',
'422': 'Unprocessable Entity',
'423': 'Locked',
'424': 'Failed Dependency',
'425': 'Unordered Collection',
'426': 'Upgrade Required',
'428': 'Precondition Required',
'429': 'Too Many Requests',
'431': 'Request Header Fields Too Large',
'451': 'Unavailable For Legal Reasons',
'500': 'Internal Server Error',
'501': 'Not Implemented',
'502': 'Bad Gateway',
'503': 'Service Unavailable',
'504': 'Gateway Timeout',
'505': 'HTTP Version Not Supported',
'506': 'Variant Also Negotiates',
'507': 'Insufficient Storage',
'508': 'Loop Detected',
'509': 'Bandwidth Limit Exceeded',
'510': 'Not Extended',
'511': 'Network Authentication Required'
},
Agent: { [Function: Agent] super_: { [Function: EventEmitter] once: [Function: once],
EventEmitter: [Circular],
usingDomains: false,
defaultMaxListeners: [Getter / Setter],
init: [Function],
listenerCount: [Function]
},
defaultMaxSockets: Infinity
},
ClientRequest: { [Function: ClientRequest] super_: { [Function: OutgoingMessage] super_: [Function]
}
},
IncomingMessage: { [Function: IncomingMessage] super_: { [Function: Readable] ReadableState: [Function: ReadableState],
super_: [Function],
_fromList: [Function: fromList]
}
},
OutgoingMessage: { [Function: OutgoingMessage] super_: { [Function: Stream] super_: [Function],
Readable: [Function],
Writable: [Function],
Duplex: [Function],
Transform: [Function],
PassThrough: [Function],
pipeline: [Function: pipeline],
finished: [Function: eos],
Stream: [Circular],
_isUint8Array: [Function: isUint8Array],
_uint8ArrayToBuffer: [Function: _uint8ArrayToBuffer]
}
},
Server: { [Function: Server] super_: { [Function: Server] super_: [Function]
}
},
ServerResponse: { [Function: ServerResponse] super_: { [Function: OutgoingMessage] super_: [Function]
}
},
createServer: [Function: createServer],
get: [Function: get],
request: [Function: request],
maxHeaderSize: [Getter],
globalAgent: [Getter / Setter]
}
console.log(Buffer);
{ [Function: Buffer] poolSize: 8192,
from: [Function: from],
of: [Function: of],
alloc: [Function: alloc],
allocUnsafe: [Function: allocUnsafe],
allocUnsafeSlow: [Function: allocUnsafeSlow],
isBuffer: [Function: isBuffer],
compare: [Function: compare],
isEncoding: [Function: isEncoding],
concat: [Function: concat],
byteLength: [Function: byteLength],
[Symbol(kIsEncodingSymbol)] : [Function: isEncoding]
}
const stream = require('stream');
console.log(stream);
{ [Function: Stream] super_: { [Function: EventEmitter] once: [Function: once],
EventEmitter: [Circular],
usingDomains: false,
defaultMaxListeners: [Getter / Setter],
init: [Function],
listenerCount: [Function]
},
Readable: { [Function: Readable] ReadableState: [Function: ReadableState],
super_: [Circular],
_fromList: [Function: fromList]
},
Writable: { [Function: Writable] WritableState: [Function: WritableState],
super_: [Circular]
},
Duplex: { [Function: Duplex] super_: { [Function: Readable] ReadableState: [Function: ReadableState],
super_: [Circular],
_fromList: [Function: fromList]
}
},
Transform: { [Function: Transform] super_: { [Function: Duplex] super_: [Function]
}
},
PassThrough: { [Function: PassThrough] super_: { [Function: Transform] super_: [Function]
}
},
pipeline: [Function: pipeline],
finished: [Function: eos],
Stream: [Circular],
_isUint8Array: [Function: isUint8Array],
_uint8ArrayToBuffer: [Function: _uint8ArrayToBuffer]
}
const zlib = require('zlib');
console.log(zlib);
{
Deflate: { [Function: Deflate] super_: { [Function: Zlib] super_: [Function]
}
},
Inflate: { [Function: Inflate] super_: { [Function: Zlib] super_: [Function]
}
},
Gzip: { [Function: Gzip] super_: { [Function: Zlib] super_: [Function]
}
},
Gunzip: { [Function: Gunzip] super_: { [Function: Zlib] super_: [Function]
}
},
DeflateRaw: { [Function: DeflateRaw] super_: { [Function: Zlib] super_: [Function]
}
},
InflateRaw: { [Function: InflateRaw] super_: { [Function: Zlib] super_: [Function]
}
},
Unzip: { [Function: Unzip] super_: { [Function: Zlib] super_: [Function]
}
},
BrotliCompress: [Function: BrotliCompress],
BrotliDecompress: [Function: BrotliDecompress],
deflate: [Function: asyncBufferWrapper],
deflateSync: [Function: syncBufferWrapper],
gzip: [Function: asyncBufferWrapper],
gzipSync: [Function: syncBufferWrapper],
deflateRaw: [Function: asyncBufferWrapper],
deflateRawSync: [Function: syncBufferWrapper],
unzip: [Function: asyncBufferWrapper],
unzipSync: [Function: syncBufferWrapper],
inflate: [Function: asyncBufferWrapper],
inflateSync: [Function: syncBufferWrapper],
gunzip: [Function: asyncBufferWrapper],
gunzipSync: [Function: syncBufferWrapper],
inflateRaw: [Function: asyncBufferWrapper],
inflateRawSync: [Function: syncBufferWrapper],
brotliCompress: [Function: asyncBufferWrapper],
brotliCompressSync: [Function: syncBufferWrapper],
brotliDecompress: [Function: asyncBufferWrapper],
brotliDecompressSync: [Function: syncBufferWrapper],
createDeflate: [Function: value],
createInflate: [Function: value],
createDeflateRaw: [Function: value],
createInflateRaw: [Function: value],
createGzip: [Function: value],
createGunzip: [Function: value],
createUnzip: [Function: value],
createBrotliCompress: [Function: value],
createBrotliDecompress: [Function: value],
constants: [Object: null prototype] {
Z_NO_FLUSH: 0,
Z_PARTIAL_FLUSH: 1,
Z_SYNC_FLUSH: 2,
Z_FULL_FLUSH: 3,
Z_FINISH: 4,
Z_BLOCK: 5,
Z_OK: 0,
Z_STREAM_END: 1,
Z_NEED_DICT: 2,
Z_ERRNO: -1,
Z_STREAM_ERROR: -2,
Z_DATA_ERROR: -3,
Z_MEM_ERROR: -4,
Z_BUF_ERROR: -5,
Z_VERSION_ERROR: -6,
Z_NO_COMPRESSION: 0,
Z_BEST_SPEED: 1,
Z_BEST_COMPRESSION: 9,
Z_DEFAULT_COMPRESSION: -1,
Z_FILTERED: 1,
Z_HUFFMAN_ONLY: 2,
Z_RLE: 3,
Z_FIXED: 4,
Z_DEFAULT_STRATEGY: 0,
ZLIB_VERNUM: 4784,
DEFLATE: 1,
INFLATE: 2,
GZIP: 3,
GUNZIP: 4,
DEFLATERAW: 5,
INFLATERAW: 6,
UNZIP: 7,
BROTLI_DECODE: 8,
BROTLI_ENCODE: 9,
Z_MIN_WINDOWBITS: 8,
Z_MAX_WINDOWBITS: 15,
Z_DEFAULT_WINDOWBITS: 15,
Z_MIN_CHUNK: 64,
Z_MAX_CHUNK: Infinity,
Z_DEFAULT_CHUNK: 16384,
Z_MIN_MEMLEVEL: 1,
Z_MAX_MEMLEVEL: 9,
Z_DEFAULT_MEMLEVEL: 8,
Z_MIN_LEVEL: -1,
Z_MAX_LEVEL: 9,
Z_DEFAULT_LEVEL: -1,
BROTLI_OPERATION_PROCESS: 0,
BROTLI_OPERATION_FLUSH: 1,
BROTLI_OPERATION_FINISH: 2,
BROTLI_OPERATION_EMIT_METADATA: 3,
BROTLI_PARAM_MODE: 0,
BROTLI_MODE_GENERIC: 0,
BROTLI_MODE_TEXT: 1,
BROTLI_MODE_FONT: 2,
BROTLI_DEFAULT_MODE: 0,
BROTLI_PARAM_QUALITY: 1,
BROTLI_MIN_QUALITY: 0,
BROTLI_MAX_QUALITY: 11,
BROTLI_DEFAULT_QUALITY: 11,
BROTLI_PARAM_LGWIN: 2,
BROTLI_MIN_WINDOW_BITS: 10,
BROTLI_MAX_WINDOW_BITS: 24,
BROTLI_LARGE_MAX_WINDOW_BITS: 30,
BROTLI_DEFAULT_WINDOW: 22,
BROTLI_PARAM_LGBLOCK: 3,
BROTLI_MIN_INPUT_BLOCK_BITS: 16,
BROTLI_MAX_INPUT_BLOCK_BITS: 24,
BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
BROTLI_PARAM_SIZE_HINT: 5,
BROTLI_PARAM_LARGE_WINDOW: 6,
BROTLI_PARAM_NPOSTFIX: 7,
BROTLI_PARAM_NDIRECT: 8,
BROTLI_DECODER_RESULT_ERROR: 0,
BROTLI_DECODER_RESULT_SUCCESS: 1,
BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
BROTLI_DECODER_NO_ERROR: 0,
BROTLI_DECODER_SUCCESS: 1,
BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
BROTLI_DECODER_ERROR_UNREACHABLE: -31
},
codes: {
'0': 'Z_OK',
'1': 'Z_STREAM_END',
'2': 'Z_NEED_DICT',
Z_OK: 0,
Z_STREAM_END: 1,
Z_NEED_DICT: 2,
Z_ERRNO: -1,
Z_STREAM_ERROR: -2,
Z_DATA_ERROR: -3,
Z_MEM_ERROR: -4,
Z_BUF_ERROR: -5,
Z_VERSION_ERROR: -6,
'-1': 'Z_ERRNO',
'-2': 'Z_STREAM_ERROR',
'-3': 'Z_DATA_ERROR',
'-4': 'Z_MEM_ERROR',
'-5': 'Z_BUF_ERROR',
'-6': 'Z_VERSION_ERROR'
},
Z_NO_FLUSH: 0,
Z_PARTIAL_FLUSH: 1,
Z_SYNC_FLUSH: 2,
Z_FULL_FLUSH: 3,
Z_FINISH: 4,
Z_BLOCK: 5,
Z_OK: 0,
Z_STREAM_END: 1,
Z_NEED_DICT: 2,
Z_ERRNO: -1,
Z_STREAM_ERROR: -2,
Z_DATA_ERROR: -3,
Z_MEM_ERROR: -4,
Z_BUF_ERROR: -5,
Z_VERSION_ERROR: -6,
Z_NO_COMPRESSION: 0,
Z_BEST_SPEED: 1,
Z_BEST_COMPRESSION: 9,
Z_DEFAULT_COMPRESSION: -1,
Z_FILTERED: 1,
Z_HUFFMAN_ONLY: 2,
Z_RLE: 3,
Z_FIXED: 4,
Z_DEFAULT_STRATEGY: 0,
ZLIB_VERNUM: 4784,
DEFLATE: 1,
INFLATE: 2,
GZIP: 3,
GUNZIP: 4,
DEFLATERAW: 5,
INFLATERAW: 6,
UNZIP: 7,
Z_MIN_WINDOWBITS: 8,
Z_MAX_WINDOWBITS: 15,
Z_DEFAULT_WINDOWBITS: 15,
Z_MIN_CHUNK: 64,
Z_MAX_CHUNK: Infinity,
Z_DEFAULT_CHUNK: 16384,
Z_MIN_MEMLEVEL: 1,
Z_MAX_MEMLEVEL: 9,
Z_DEFAULT_MEMLEVEL: 8,
Z_MIN_LEVEL: -1,
Z_MAX_LEVEL: 9,
Z_DEFAULT_LEVEL: -1
}
console.log(console);
Console {
log: [Function: bound consoleCall],
debug: [Function: bound consoleCall],
info: [Function: bound consoleCall],
dirxml: [Function: bound consoleCall],
warn: [Function: bound consoleCall],
error: [Function: bound consoleCall],
dir: [Function: bound consoleCall],
time: [Function: bound consoleCall],
timeEnd: [Function: bound consoleCall],
timeLog: [Function: bound timeLog],
trace: [Function: bound consoleCall],
assert: [Function: bound consoleCall],
clear: [Function: bound consoleCall],
count: [Function: bound consoleCall],
countReset: [Function: bound consoleCall],
group: [Function: bound consoleCall],
groupCollapsed: [Function: bound consoleCall],
groupEnd: [Function: bound consoleCall],
table: [Function: bound consoleCall],
Console: [Function: Console],
markTimeline: [Function: markTimeline],
profile: [Function: profile],
profileEnd: [Function: profileEnd],
timeline: [Function: timeline],
timelineEnd: [Function: timelineEnd],
timeStamp: [Function: timeStamp],
context: [Function: context],
[Symbol(counts)] : Map {},
[Symbol(kColorMode)] : 'auto'
}
const url = require('url');
console.log(url);
{
Url: [Function: Url],
parse: [Function: urlParse],
resolve: [Function: urlResolve],
resolveObject: [Function: urlResolveObject],
format: [Function: urlFormat],
URL: [Function: URL],
URLSearchParams: [Function: URLSearchParams],
domainToASCII: [Function: domainToASCII],
domainToUnicode: [Function: domainToUnicode],
pathToFileURL: [Function: pathToFileURL],
fileURLToPath: [Function: fileURLToPath]
}
const os = require('os');
console.log(os);
{
arch: { [Function: arch][Symbol(Symbol.toPrimitive)] : [Function]
},
cpus: [Function: cpus],
endianness: { [Function: endianness][Symbol(Symbol.toPrimitive)] : [Function]
},
freemem: { [Function: getFreeMem][Symbol(Symbol.toPrimitive)] : [Function]
},
getPriority: [Function: getPriority],
homedir: { [Function: checkError][Symbol(Symbol.toPrimitive)] : [Function]
},
hostname: { [Function: checkError][Symbol(Symbol.toPrimitive)] : [Function]
},
loadavg: [Function: loadavg],
networkInterfaces: [Function: networkInterfaces],
platform: { [Function: platform][Symbol(Symbol.toPrimitive)] : [Function]
},
release: { [Function: checkError][Symbol(Symbol.toPrimitive)] : [Function]
},
setPriority: [Function: setPriority],
tmpdir: { [Function: tmpdir][Symbol(Symbol.toPrimitive)] : [Function]
},
totalmem: { [Function: getTotalMem][Symbol(Symbol.toPrimitive)] : [Function]
},
type: { [Function: checkError][Symbol(Symbol.toPrimitive)] : [Function]
},
userInfo: [Function: userInfo],
uptime: { [Function: getUptime][Symbol(Symbol.toPrimitive)] : [Function]
},
getNetworkInterfaces: [Function: deprecated],
tmpDir: [Function: deprecated],
constants: [Object: null prototype] {
UV_UDP_REUSEADDR: 4,
dlopen: [Object: null prototype] {},
errno: [Object: null prototype] {
E2BIG: 7,
EACCES: 13,
EADDRINUSE: 100,
EADDRNOTAVAIL: 101,
EAFNOSUPPORT: 102,
EAGAIN: 11,
EALREADY: 103,
EBADF: 9,
EBADMSG: 104,
EBUSY: 16,
ECANCELED: 105,
ECHILD: 10,
ECONNABORTED: 106,
ECONNREFUSED: 107,
ECONNRESET: 108,
EDEADLK: 36,
EDESTADDRREQ: 109,
EDOM: 33,
EEXIST: 17,
EFAULT: 14,
EFBIG: 27,
EHOSTUNREACH: 110,
EIDRM: 111,
EILSEQ: 42,
EINPROGRESS: 112,
EINTR: 4,
EINVAL: 22,
EIO: 5,
EISCONN: 113,
EISDIR: 21,
ELOOP: 114,
EMFILE: 24,
EMLINK: 31,
EMSGSIZE: 115,
ENAMETOOLONG: 38,
ENETDOWN: 116,
ENETRESET: 117,
ENETUNREACH: 118,
ENFILE: 23,
ENOBUFS: 119,
ENODATA: 120,
ENODEV: 19,
ENOENT: 2,
ENOEXEC: 8,
ENOLCK: 39,
ENOLINK: 121,
ENOMEM: 12,
ENOMSG: 122,
ENOPROTOOPT: 123,
ENOSPC: 28,
ENOSR: 124,
ENOSTR: 125,
ENOSYS: 40,
ENOTCONN: 126,
ENOTDIR: 20,
ENOTEMPTY: 41,
ENOTSOCK: 128,
ENOTSUP: 129,
ENOTTY: 25,
ENXIO: 6,
EOPNOTSUPP: 130,
EOVERFLOW: 132,
EPERM: 1,
EPIPE: 32,
EPROTO: 134,
EPROTONOSUPPORT: 135,
EPROTOTYPE: 136,
ERANGE: 34,
EROFS: 30,
ESPIPE: 29,
ESRCH: 3,
ETIME: 137,
ETIMEDOUT: 138,
ETXTBSY: 139,
EWOULDBLOCK: 140,
EXDEV: 18,
WSAEINTR: 10004,
WSAEBADF: 10009,
WSAEACCES: 10013,
WSAEFAULT: 10014,
WSAEINVAL: 10022,
WSAEMFILE: 10024,
WSAEWOULDBLOCK: 10035,
WSAEINPROGRESS: 10036,
WSAEALREADY: 10037,
WSAENOTSOCK: 10038,
WSAEDESTADDRREQ: 10039,
WSAEMSGSIZE: 10040,
WSAEPROTOTYPE: 10041,
WSAENOPROTOOPT: 10042,
WSAEPROTONOSUPPORT: 10043,
WSAESOCKTNOSUPPORT: 10044,
WSAEOPNOTSUPP: 10045,
WSAEPFNOSUPPORT: 10046,
WSAEAFNOSUPPORT: 10047,
WSAEADDRINUSE: 10048,
WSAEADDRNOTAVAIL: 10049,
WSAENETDOWN: 10050,
WSAENETUNREACH: 10051,
WSAENETRESET: 10052,
WSAECONNABORTED: 10053,
WSAECONNRESET: 10054,
WSAENOBUFS: 10055,
WSAEISCONN: 10056,
WSAENOTCONN: 10057,
WSAESHUTDOWN: 10058,
WSAETOOMANYREFS: 10059,
WSAETIMEDOUT: 10060,
WSAECONNREFUSED: 10061,
WSAELOOP: 10062,
WSAENAMETOOLONG: 10063,
WSAEHOSTDOWN: 10064,
WSAEHOSTUNREACH: 10065,
WSAENOTEMPTY: 10066,
WSAEPROCLIM: 10067,
WSAEUSERS: 10068,
WSAEDQUOT: 10069,
WSAESTALE: 10070,
WSAEREMOTE: 10071,
WSASYSNOTREADY: 10091,
WSAVERNOTSUPPORTED: 10092,
WSANOTINITIALISED: 10093,
WSAEDISCON: 10101,
WSAENOMORE: 10102,
WSAECANCELLED: 10103,
WSAEINVALIDPROCTABLE: 10104,
WSAEINVALIDPROVIDER: 10105,
WSAEPROVIDERFAILEDINIT: 10106,
WSASYSCALLFAILURE: 10107,
WSASERVICE_NOT_FOUND: 10108,
WSATYPE_NOT_FOUND: 10109,
WSA_E_NO_MORE: 10110,
WSA_E_CANCELLED: 10111,
WSAEREFUSED: 10112
},
signals: [Object: null prototype] {
SIGHUP: 1,
SIGINT: 2,
SIGILL: 4,
SIGABRT: 22,
SIGFPE: 8,
SIGKILL: 9,
SIGSEGV: 11,
SIGTERM: 15,
SIGBREAK: 21,
SIGWINCH: 28
},
priority: [Object: null prototype] {
PRIORITY_LOW: 19,
PRIORITY_BELOW_NORMAL: 10,
PRIORITY_NORMAL: 0,
PRIORITY_ABOVE_NORMAL: -7,
PRIORITY_HIGH: -14,
PRIORITY_HIGHEST: -20
}
},
EOL: '\r\n'
}
// test01.txt
test01.txt
// index.js
fs.readFile('./test01.txt', function (err, data) {
if(err) throw err;
console.log('文件内容:', data); // 文件内容: <Buffer 0d 0a 74 65 73 74 30 31 2e 74 78 74 0d 0a 0d 0a 0d 0a 0d 0a>
});
// test01.txt
test01.txt
// index.js
fs.readFile('./test01.txt', 'utf8', function (err, data) {
if(err) throw err;
console.log('文件内容:', data); // 文件内容:test01.txt
});
console.log(process);
process {
title: 'D:\\develop\\nodejs\\node.exe',
version: 'v10.16.0',
versions: {
http_parser: '2.8.0',
node: '10.16.0',
v8: '6.8.275.32-node.52',
uv: '1.28.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '64',
nghttp2: '1.34.0',
napi: '4',
openssl: '1.1.1b',
icu: '64.2',
unicode: '12.1',
cldr: '35.1',
tz: '2019a'
},
arch: 'x64',
platform: 'win32',
release: {
name: 'node',
lts: 'Dubnium',
sourceUrl: 'https://nodejs.org/download/release/v10.16.0/node-v10.16.0.tar.gz',
headersUrl: 'https://nodejs.org/download/release/v10.16.0/node-v10.16.0-headers.tar.gz',
libUrl: 'https://nodejs.org/download/release/v10.16.0/win-x64/node.lib'
},
argv: ['D:\\develop\\nodejs\\node.exe', 'E:\\linfeimy\\02personal\\Node.js-Demo\\Node.js v10.6.2\\events\\index.js'],
execArgv: [],
env: {
ALLUSERSPROFILE: 'C:\\ProgramData',
APPDATA: 'C:\\Users\\qian0\\AppData\\Roaming',
'asl.log': 'Destination=file',
COLORTERM: 'true',
CommonProgramFiles: 'C:\\Program Files\\Common Files',
'CommonProgramFiles(x86)': 'C:\\Program Files (x86)\\Common Files',
CommonProgramW6432: 'C:\\Program Files\\Common Files',
COMPUTERNAME: 'DESKTOP-O11HVTS',
ComSpec: 'C:\\Windows\\system32\\cmd.exe',
DEBUG_COLORS: 'true',
DriverData: 'C:\\Windows\\System32\\Drivers\\DriverData',
ELECTRON_NO_ATTACH_CONSOLE: 'true',
FORCE_COLOR: 'true',
FPS_BROWSER_APP_PROFILE_STRING: 'Internet Explorer',
FPS_BROWSER_USER_PROFILE_STRING: 'Default',
HOMEDRIVE: 'C:',
HOMEPATH: '\\Users\\qian0',
LOCALAPPDATA: 'C:\\Users\\qian0\\AppData\\Local',
LOGONSERVER: '\\\\DESKTOP-O11HVTS',
MOCHA_COLORS: '1',
MOZ_PLUGIN_PATH: 'D:\\tools\\edit\\foxit_Offline_FoxitInst\\Foxit Reader\\plugins\\',
npm_config_color: 'always',
NUMBER_OF_PROCESSORS: '4',
OneDrive: 'C:\\Users\\qian0\\OneDrive',
OneDriveConsumer: 'C:\\Users\\qian0\\OneDrive',
OS: 'Windows_NT',
Path: 'D:\\develop\\WebStorm-2019.2\\WebStorm 2019.2\\jbr\\\\bin;D:\\develop\\WebStorm-2019.2\\WebStorm 2019.2\\jbr\\\\bin\\server;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;D:\\develop\\nodejs\\;D:\\develop\\git\\Git\\cmd;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;D:\\develop\\Anaconda3-5.3.1-Windows-x86_64;D:\\develop\\Anaconda3-5.3.1-Windows-x86_64\\Library\\mingw-w64\\bin;D:\\develop\\Anaconda3-5.3.1-Windows-x86_64\\Library\\usr\\bin;D:\\develop\\Anaconda3-5.3.1-Windows-x86_64\\Library\\bin;D:\\develop\\Anaconda3-5.3.1-Windows-x86_64\\Scripts;D:\\develop\\python-3.7.4-amd64\\Scripts\\;D:\\develop\\python-3.7.4-amd64\\;C:\\Users\\qian0\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\qian0\\AppData\\Roaming\\npm;D:\\develop\\VSCode\\Microsoft VS Code\\bin;D:\\develop\\FiddlerSetup\\Fiddler;D:\\develop\\pycharm-community-2019.1.3\\bin;',
PATHEXT: '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
PROCESSOR_ARCHITECTURE: 'AMD64',
PROCESSOR_IDENTIFIER: 'Intel64 Family 6 Model 58 Stepping 9, GenuineIntel',
PROCESSOR_LEVEL: '6',
PROCESSOR_REVISION: '3a09',
ProgramData: 'C:\\ProgramData',
ProgramFiles: 'C:\\Program Files',
'ProgramFiles(x86)': 'C:\\Program Files (x86)',
ProgramW6432: 'C:\\Program Files',
PSModulePath: 'C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules',
PUBLIC: 'C:\\Users\\Public',
'PyCharm Community Edition': 'D:\\develop\\pycharm-community-2019.1.3\\bin;',
SESSIONNAME: 'Console',
SystemDrive: 'C:',
SystemRoot: 'C:\\Windows',
TEMP: 'C:\\Users\\qian0\\AppData\\Local\\Temp',
TMP: 'C:\\Users\\qian0\\AppData\\Local\\Temp',
USERDOMAIN: 'DESKTOP-O11HVTS',
USERDOMAIN_ROAMINGPROFILE: 'DESKTOP-O11HVTS',
USERNAME: 'qian0',
USERPROFILE: 'C:\\Users\\qian0',
windir: 'C:\\Windows'
},
pid: 8720,
features: {
debug: false,
uv: true,
ipv6: true,
tls_alpn: true,
tls_sni: true,
tls_ocsp: true,
tls: true
},
ppid: 7968,
execPath: 'D:\\develop\\nodejs\\node.exe',
debugPort: 9229,
_debugProcess: [Function: _debugProcess],
_debugEnd: [Function: _debugEnd],
_startProfilerIdleNotifier: [Function: _startProfilerIdleNotifier],
_stopProfilerIdleNotifier: [Function: _stopProfilerIdleNotifier],
abort: [Function: abort],
chdir: [Function: chdir],
umask: [Function: umask],
_getActiveRequests: [Function: _getActiveRequests],
_getActiveHandles: [Function: _getActiveHandles],
_kill: [Function: _kill],
cwd: [Function: cwd],
dlopen: [Function: dlopen],
reallyExit: [Function: reallyExit],
uptime: [Function: uptime],
_rawDebug: [Function],
moduleLoadList: ['Internal Binding module_wrap', 'Binding contextify', 'Internal Binding worker', 'NativeModule events', 'NativeModule internal/async_hooks', 'NativeModule internal/errors', 'Binding uv', 'Binding buffer', 'Binding async_wrap', 'Internal Binding async_wrap', 'Binding config', 'Binding icu', 'NativeModule util', 'NativeModule internal/util/inspect', 'Binding util', 'NativeModule internal/util', 'Binding constants', 'Internal Binding types', 'NativeModule internal/util/types', 'NativeModule internal/validators', 'NativeModule internal/encoding', 'Internal Binding icu', 'NativeModule buffer', 'NativeModule internal/buffer', 'NativeModule internal/process/per_thread', 'NativeModule internal/process/main_thread_only', 'NativeModule internal/process/stdio', 'NativeModule assert', 'NativeModule internal/assert', 'NativeModule fs', 'NativeModule path', 'NativeModule internal/constants', 'Binding fs', 'NativeModule internal/fs/streams', 'NativeModule internal/fs/utils', 'NativeModule stream', 'NativeModule internal/streams/pipeline', 'NativeModule internal/streams/end-of-stream', 'NativeModule internal/streams/legacy', 'NativeModule _stream_readable', 'NativeModule internal/streams/buffer_list', 'NativeModule internal/streams/destroy', 'NativeModule internal/streams/state', 'NativeModule _stream_writable', 'NativeModule _stream_duplex', 'NativeModule _stream_transform', 'NativeModule _stream_passthrough', 'NativeModule internal/url', 'NativeModule internal/querystring', 'Binding url', 'NativeModule internal/process/warning', 'NativeModule internal/process/next_tick', 'NativeModule internal/process/promises', 'Internal Binding util', 'NativeModule internal/fixed_queue', 'Binding performance', 'Binding trace_events', 'NativeModule internal/inspector_async_hook', 'Binding inspector', 'NativeModule internal/options', 'Internal Binding options', 'NativeModule timers', 'Binding timer_wrap', 'NativeModule internal/linkedlist', 'NativeModule internal/timers', 'NativeModule console', 'Binding tty_wrap', 'Internal Binding tty_wrap', 'NativeModule net', 'NativeModule internal/net', 'Binding stream_wrap', 'Binding tcp_wrap', 'Binding pipe_wrap', 'NativeModule internal/stream_base_commons', 'Internal Binding stream_wrap', 'Internal Binding uv', 'NativeModule internal/modules/cjs/loader', 'NativeModule vm', 'NativeModule internal/modules/cjs/helpers', 'NativeModule url', 'NativeModule internal/safe_globals', 'Internal Binding contextify'],
binding: [Function: binding],
_linkedBinding: [Function: _linkedBinding],
_events: [Object: null prototype] {
newListener: [Function],
removeListener: [Function],
warning: [Function]
},
_eventsCount: 3,
_maxListeners: undefined,
_fatalException: [Function],
domain: null,
_exiting: false,
assert: [Function: deprecated],
config: {
target_defaults: {
cflags: [],
default_configuration: 'Release',
defines: [],
include_dirs: [],
libraries: []
},
variables: {
asan: 0,
build_v8_with_gn: false,
coverage: false,
debug_nghttp2: false,
enable_lto: false,
enable_pgo_generate: false,
enable_pgo_use: false,
force_dynamic_crt: 0,
host_arch: 'x64',
icu_data_in: '..\\..\\deps/icu-small\\source/data/in\\icudt64l.dat',
icu_endianness: 'l',
icu_gyp_path: 'tools/icu/icu-generic.gyp',
icu_locales: 'en,root',
icu_path: 'deps/icu-small',
icu_small: true,
icu_ver_major: '64',
nasm_version: '2.14',
node_byteorder: 'little',
node_debug_lib: false,
node_enable_d8: false,
node_enable_v8_vtunejit: false,
node_install_npm: true,
node_module_version: 64,
node_no_browser_globals: false,
node_prefix: '/usr/local',
node_release_urlbase: 'https://nodejs.org/download/release/',
node_shared: false,
node_shared_cares: false,
node_shared_http_parser: false,
node_shared_libuv: false,
node_shared_nghttp2: false,
node_shared_openssl: false,
node_shared_zlib: false,
node_tag: '',
node_target_type: 'executable',
node_use_bundled_v8: true,
node_use_dtrace: false,
node_use_etw: true,
node_use_large_pages: false,
node_use_openssl: true,
node_use_pch: false,
node_use_perfctr: true,
node_use_v8_platform: true,
node_with_ltcg: true,
node_without_node_options: false,
openssl_fips: '',
openssl_no_asm: 0,
shlib_suffix: 'so.64',
target_arch: 'x64',
v8_enable_gdbjit: 0,
v8_enable_i18n_support: 1,
v8_enable_inspector: 1,
v8_no_strict_aliasing: 1,
v8_optimized_debug: 0,
v8_promise_internal_field_count: 1,
v8_random_seed: 0,
v8_trace_maps: 0,
v8_typed_array_max_size_in_heap: 0,
v8_use_snapshot: true,
want_separate_host_toolset: 0
}
},
setUncaughtExceptionCaptureCallback: [Function],
hasUncaughtExceptionCaptureCallback: [Function],
emitWarning: [Function],
nextTick: [Function: nextTick],
_tickCallback: [Function: _tickCallback],
stdout: [Getter],
stderr: [Getter],
stdin: [Getter],
openStdin: [Function],
hrtime: { [Function: hrtime] bigint: [Function]
},
cpuUsage: [Function: cpuUsage],
memoryUsage: [Function: memoryUsage],
exit: [Function],
kill: [Function],
argv0: 'D:\\develop\\nodejs\\node.exe',
allowedNodeEnvironmentFlags: [Getter / Setter],
mainModule: Module {
id: '.',
exports: {},
parent: null,
filename: 'E:\\linfeimy\\02personal\\Node.js-Demo\\Node.js v10.6.2\\events\\index.js',
loaded: false,
children: [],
paths: ['E:\\linfeimy\\02personal\\Node.js-Demo\\Node.js v10.6.2\\events\\node_modules', 'E:\\linfeimy\\02personal\\Node.js-Demo\\Node.js v10.6.2\\node_modules', 'E:\\linfeimy\\02personal\\Node.js-Demo\\node_modules', 'E:\\linfeimy\\02personal\\node_modules', 'E:\\linfeimy\\node_modules', 'E:\\node_modules']
}
}
const path = require('path');
console.log(path);
{
resolve: [Function: resolve],
normalize: [Function: normalize],
isAbsolute: [Function: isAbsolute],
join: [Function: join],
relative: [Function: relative],
toNamespacedPath: [Function: toNamespacedPath],
dirname: [Function: dirname],
basename: [Function: basename],
extname: [Function: extname],
format: [Function: format],
parse: [Function: parse],
sep: '\\',
delimiter: ';',
win32: [Circular],
posix: {
resolve: [Function: resolve],
normalize: [Function: normalize],
isAbsolute: [Function: isAbsolute],
join: [Function: join],
relative: [Function: relative],
toNamespacedPath: [Function: toNamespacedPath],
dirname: [Function: dirname],
basename: [Function: basename],
extname: [Function: extname],
format: [Function: format],
parse: [Function: parse],
sep: '/',
delimiter: ':',
win32: [Circular],
posix: [Circular],
_makeLong: [Function: toNamespacedPath]
},
_makeLong: [Function: toNamespacedPath]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.