Node js core modules A brief about each core modules

Home Forums Open-Xml-Sdk-JavaScript Node js core modules A brief about each core modules

Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by  wilbertalderman 1 year, 3 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #11244

    wilbertalderman
    Participant

    Node.js is a Javascript engine. It can be used to run Javascript outside of the browser. You can use Node’s functions to build software on top of the ecosystem. Even though there are numerous template engine libraries available for Node, the Python library is accessible from the C++ core modules.

    Below you can find a list of core modules and their specific functions –

    Addons for c/c++ programming –

    Node.js Addons are dynamiclinked shared objects that are written in C or C++ and can be loaded into a Node.js program with the require() function. This allows programmers to enjoy the benefits of using JavaScript to interface with other C/C++ libraries, but with a Node.js structure. One reason for developing the method, in comparison to the methods of creating Node.js libraries, is to allow for an easy integration of JavaScript into C/C++ programs.

    Child processes

    spawns child processes in a way that’s much closer to pOpen but not exactly same as the pOpen.

    The child process module of Node makes it simple for us to start a child process, and a messaging system makes it straightforward for child processes to communicate with one another and with their parent process.

    By executing any system command within a child process, which is made possible by the child process module, we are able to gain access to the capabilities of the operating system.

    The input stream of the child process can be controlled by us, and we can also listen to the stream it produces. We have full control over the arguments that are sent to the underlying operating system command, and we are free to do whatever we want with the results of that command.

    clusters

    Node.js runs in a single thread. To take advantage of multi-core systems, the user needs to launch multiple instances of Node.js where each instance uses a specific port. To do so, the cluster module allows you to easily create a cluster of Node.js processes that all share a single port.

    Crypto module in nodejs

    It includes wrappers around OpenSSL’s hash, assymetric key cryptography, symmetric, cipher, decipher, sign, and verify functions.

    Crypto is incorporated in Node.js, so there is no need to install it before using it in your Node.js application.

    The “crypto” class creates hash functions. Hash functions are functions that turn plaintexts into longer, more complex, non-reusable information. Hashing is one way to secure data on your system. For hashing, you encode a piece of information after encrypting it; this is called a message authentication code. A hash function combines a key with an input message to create a digest says docid. Hash functions are too complex to decrypt. Similar hashes can be created for different things, like the bank number or user name for the bank account holder. The key part, or the “secret”, would be the only part the bank can get back.

    The Buffer module

    Before the introduction of TypedArray in ECMAScript 2015, the JavaScript language did not support a mechanism for reading or manipulating streams of binary data. Coming up with the Buffer class has allowed developers to work with streams that involve binary data in the context of domains such as TCP streams or file operations.

    Now that TypedArrays (the auto-sized arrays in ES6) have recently been added, Buffer provides the Uint8Array API in a manner that is more optimized and suitable for Node.js’

    Domain module

    This module is about to be deprecated. This module will be completely deprecated once a successor API is ready. The majority of end users shouldn’t need to utilise this module. Users who must have the capability offered by domains now may do so for the time being, but they should prepare to switch to another option down the road.

    DNS module

    The Domain Name System (DNS) Module Contains Functions That Fall Into Two Separate Categories

    1. Name resolution operations that are carried out by functions that make use of the facilities provided by the underlying operating system, and

    that are not need to necessarily carry out any type of network communication.

    2. functions that conduct name resolution by connecting to a real DNS server in order to do so, and that consistently do so

    Make use of the network to issue DNS query requests.

    The filesystem module (fs)

    The library that is used by Node.js includes a fs module that can be used. It is equipped with a wide variety of features that can facilitate the management of files and folders. Among the many file and directory operations that are supported, some of the more fundamental ones include opening and altering files within directories.

    It is also capable of performing the same actions with files. It is able to accomplish this in a synchronous as well as an asynchronous manner. It comes with an asynchronous application programming interface (API) that supports promise-based functions. In addition to that, it may provide statistics pertaining to a file.

    The built-in file system module is capable of performing the vast majority of the file operations that come to mind.

    Events module

    A significant portion of the Node.js core application programming interface is based on an idiomatic event-driven architecture. In this architecture, particular categories of objects (which are referred to as “emitters”) periodically emit named events that cause other object types (referred to as “listeners”) to be called.

    HTTP module

    There is a built-in module in Node.js called HTTP that allows you to send data via the HTTP protocol and make HTTP requests in It is necessary for us to require the HTTP module in order to use the HTTP server in node. The HTTP module will establish an HTTP server that will respond to requests from clients after it has listened to requests on server ports.

    The HTTP interfaces that are included in Node.js have been built with the intention of supporting many elements of the HTTP protocol that have historically been difficult to use. Specifically, lengthy communications that could be chunk-encoded. The user is able to stream data because the interface takes care to never buffer the entirety of either the request or the respone.

    The HTTPS module
    HTTPS is the HTTP protocol that is encrypted using TLS or SSL. This functionality is implemented in Node.js as its own independent module.

    The acronym HTTPS stands for the Hypertext Transfer Protocol Secure. This protocol is an extension of the Hypertext Transfer Protocol, also known as HTTP, and it is a more secure version of HTTP. It is frequently utilised on the internet for the purpose of facilitating encrypted communication between computer networks.

    The Assert Module

    Expressions can be tested using the assert module’s provided functionality. In the event that the expression is evaluated to zero or to the incorrect value, an assertion failure will be caused, and the programme will be terminated.

    It makes available a wide variety of functions that can be put to use in the process of function assertion. A program’s invariants can be checked using these functions, which are provided by this module. We may perform a null check in addition to a variety of other checks by utilising assertion. The assertion has no bearing on any implementations that are currently active. The condition is the sole thing that is checked, and an error is only thrown if the condition is not satisfied.

    Deprecated API’s module

    The following list of factors could lead to the deprecation of some Node.js APIs:

    It is not recommended to use the API.

    In a future major release, we anticipate there will be breaking changes made to the API.

    There is also a more advanced alternative API accessible.

    There are three different sorts of deprecations in Node.js:

    Runtime\ Documentation-only\ End-of-Life

    Net Module
    An asynchronous network application programming interface is made available by the node Net module, which can be used to create stream-based TCP or IPC servers.

    On Windows, this module allows interprocess communication (IPC) with named pipes. On other operating systems, it supports Unix domain sockets.

    The Node.js net module can be utilised for the creation of servers as well as clients. A wrapper for asynchronous network communication is provided by this module.

    The readline module

    The Node js Readline Module is just a wrapper around the process standard output and process standard input objects. When I say wrapper, I mean that it adds additional functionality, is easier to comprehend, and is much simpler to implement.

    Therefore, rather than directly using the process standard input and output, we may use the Node js Readline Module to perform somewhat more complex tasks.

    This Node.js Module enables line-by-line input stream reading. This module encapsulates the standard output and input items for the process. Readline module facilitates entry and reading of the user-provided output.

    The OS module

    The Node.js os module provides some fundamental utility functions related to operating systems.

    NodeJS OS is used to retrieve information about the operating system installed on the Node-running machine. Node OS will interface with the Operating System on which the Node.js server is operating in order to manage the server’s resources, performance, etc. It is also intended to retrieve information on the CPU, architecture, uptime of the operating system, system constraints, total memory, available free memory, hostname, etc.

    It offers numerous characteristics and ways for interfacing with the operating system and server.

    This also provides several useful techniques for retrieving the server’s operating system.

    The Path Module

    The NodeJS Path Module is where the utilities for working with file and directory paths can be found.

    In most cases, we have operations such as getting the path pointing to the directory, getting the file name in the path, getting the file’s extension, and so on to handle file paths and filenames.

    The Querystring module

    What exactly is a Query String?

    a query string is a component of an unified resource location (URL) that assigns values to provided parameters. In plain English, it is the string that follows the question mark in a URL. Several URL samples are seen below.

    In the first instance, the query string is item=freezer

    and in the second instance, it is name1=bacardi&name2=budwiser

    The Query String module used to provide parsing and formatting tools for URL query strings.

    It can convert a query text to a JSON object and vice versa.

    The Query String is the portion of the URL following the question mark (?).

    REPL module

    REPL is an acronym for Read Eval Print and Loop. It specifies a computer environment, such as a window console or a Unix/Linux shell, in which you can submit commands and receive interactive output from the system.

    Node.js and node are packaged with a REPL environment. Each element of the REPL environment performs a distinct function.

    It parses the user’s input into a JavaScript data structure and stores it in memory.

    Eval: It takes the data structure and evaluates it.

    Print: The output is printed.

    It repeats the preceding instruction until the user presses ctrl-c twice.

    Stream module

    A stream is an interface that makes it easy to work with streaming data in JavaScript. The module API provides a basic level of an interface that leads to the creation of “streams”, which implement particularly the interface.

    There are many server-side JavaScript objects created by Node.js. For instance, a request to an HTTP server and process.stdout are both server-side JavaScript object instances.

    Streams are objects used for reading and writing data to a destination or a sourcesource in continuous fashion. In Node.js, stream objects have four types:readable streams, writable streams, duplex, and events in the buffer.

    Readable Stream A stream that can be read using the read operation.

    Writable denotes a stream that can participate in writing operations.

    The term “duplex” refers to a stream that may do both reading and writing operations.

    A sort of duplex stream in which the output is computed based on the input is referred to as a Transform stream.

    The string_decoder module

    Buffer objects provide an API for decoding strings into strings strings. The string decoder provides access to the current string and hints to generate the correct string.

    provides functions for encoding integers and strings into unsigned UTF-8 and UTF-16 encoding

    The Timers module

    The timer module exposes a global API for scheduling functions to be called at some future period of time. This is in contrast to the require(‘timers’) function which would have to be called in order to utilize the API.

    The timers functions within a Node.js can implement an API similar to the ones provided by the browsers timers API but between Node.js using a different internal implementation. To that end, it uses basic loops that function around the Node.js event loop.

    TTY module

    The Node.js TTY READ and WRITE streams module contains the TTY.ReadStream and TTY.WriteStream classes, which replace the tty.ReadStream and tty.WriteStream classes

    Class: ReadStream

    It contains a net,Socket subclass named ReadStream that represents the “readable” portion of a keyboard. In normal circumstances,the tty.ReadStream object has the only instance named process.stdin. For instance, the following is the “meaning” of the following code snippet: process.stdout.on “data

    There is a Boolean attribute named isRaw which is initialized to be false. It is used to specify the current “raw” state (which is to say, an error state is already in force

    main.rsSetRawMode(mode) should be true or false. It is used to set the properties of the tty.ReadStream to behave as a raw device or default. The readMode will be set to the resulting mode.

    Class: WriteStream

    The module includes a net.Socket.Writable subclass that represents the writable portion of a tty. In normal circumstances, the tty.WriteStreams has the only name process.stdout in any Node.js program. node-pty also makes the filename available.

    Tracing module

    Trace Event is a technique that centralises the tracing information that is created by userspace code, V8, and Node corecore.

    The node.js module known as trace events offers a technique that can consolidate the tracing information that is produced by userspace code, V8, and the core of Node.js.

    Either by using the “—trace-event-categories” command-line argument or by making use of the “node:trace_events” module, tracing can be enabled. The “—trace-event-categories” switch allows for a list of category names to be specified, which must be separated by commas.

    TLS module

    The TLS module offers a means of implementing TLS (Transport Layer Security) and SSL (Secure Socket Layer) into the application code in order to prevent unauthorised access to the database caused by potential flaws. TLS and SSL are both acronyms for the same thing: secure socket layer.

    Dgram module

    An implementation of UDP Datagram sockets is made available by the dgram module.

    V8 module

    V8 is an open source JavaScript engine developed by the Chromium project for the Google Chrome web browser. It is written in C++. Now a days, it is used in many projects such as Couchbase, MongoDB and Node.js.

    VM module

    The vm module offers application programming interfaces (APIs) that can be used to compile and run code within V8 Virtual Machine contexts. Code written in JavaScript can be compiled and executed immediately, or it can be compiled, saved, and executed at a later time.

    Please take note that the vm module does not function as a security mechanism. It should not be used to

    Util module

    The util module provides support for the requirements of the internal APIs of Node.js. There are a number of the utilities that can be helpful to application and module developers as well.

    URL module

    Utilities for resolving and interpreting URLs are provided by the ‘url’ module. The getters and setters for the properties of URL objects are implemented on the class prototype, and access to the URL class can be gained through the global object.

    The new URL() method, which was added in version 7.0.0 and version 6.13.0 respectively, is an inbuilt application programming interface of the URL module. It parses the input relative to the base and generates a new URL object as a result. If the base is given in string form, it will be interpreted as the equivalent of a new URL (base).

    Zlib module

    Gzip and Deflate/Inflate are used to provide the compression capability provided by the zlib module.

    By pipelining source stream data into a destination stream through zlib stream, a file can be compressed and decompressed.

    Thanks for reading this post

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.