Node.js Core Modules Core Modules The modules do need to use NPM install

tags: node.js  js

The modules do need to use NPM install:

These modules installed locally  with you install NODE js 

1. Path module

LOAD:

var path = require("path")

Using:

path.basename(__filename)  # pluck out the file name from the path

path.join(*args)  join a series of path name with "/"

 

2. Utilie module

var util = require("util)

util.log()  have a same result as console.log(), but it has log the time of the code loading time staple 

//++++++++++++++

util.inherits(object1, ob2)

help ob1 to inherits all of function in ob2

 

3. V8

Get current memory

var v8 = require("v8")

util.log(v8.getHeapStatistics())

=========================================================================

4. Reading module

ask question to user in termial and saving those answers 

var readline = require('readline')

var rl = readline.createInterface(process.stdin, process.stout)

# readline helps us to control thoes object 

rl.question(string, function(answer))

# ask question

# handle the answer

rl.setPrompt('');

in the question() function to repeat the question prompt

 

5. EventEmitter

require('events');

var emitter = new events.EventEmitter();

emitter.on('customEvent', function(string));

emitter.emit('customEvent', string1)

emit will push the second argument into customEvent and run it! \

 

Intelligent Recommendation

Spring----seven core modules

Spring—seven core modules [Core Container] The core container provides the basic functionality of the Spring framework. Spring organizes and manages the various components and their relationship...

spring seven core modules

The core container (Spring core) The core container provides the basic functionality of the Spring framework. Spring bean to the way the various components and their relationships to organize and mana...

node in the core modules of the fs

Implementation file contents by fs module copy: used api: fs.open(path[, flags[, mode]], callback) fs.read(fd, buffer, offset, length, position, callback) fs.write(fd, buffer[, offset[, length[, posit...

Spring-seven core modules

Architecture diagram: Seven core modules: Core container (Spring Core): Core package is the most basic part of the framework, providing IOC and dependency injection features. The basic concept here is...

Node's core modules

Commonly used node core modules: os, http, fs, path, url, querystring, crypto Node.js operating system (os module) Obtain computer system related information Node.js network module (http module) You c...

More Recommendation

Several core modules of SpringFramework

Why can't 80% of programmers be architects? >>>   Structure diagram of SpringFramework It can be seen from the figure Core Container spring-core, spring-bean: the most basic part of...

Other Nginx core modules

Official document: http://nginx.org/en/docs/ngx_core_module.html#debug_points One, debug_connection Enable the debug log of the selected client connection. Other connections will use the logging level...

LVS core components and modules

The LVS has been integrated into the Linux kernel module, but the entire LVS environment is divided into core layers and user layers, the implementation of the kernel layer load internal nuclear algor...

Four core modules of ThingBoard

Four core modules of ThingBoard Equipment Management Data access Rule Engine Parts panel That is, ThingsBoard can be used for: Equipment management, assets and customers and define their relationships...

Node.js super light speed study notes 1: 3 core modules, npm, file operations

Super light speed learning node.js notes First, create a simple server using the http module 1, import http module 2, create a server Set the http header to tell the browser status code 200 (ok), file...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top