Skip to content

Node.js Standard Module

The following Node.js standard modules are available for actions. It can be called by explicit reference in an action via a require statement.

ModuleRequireOverviewURL
UtilitiesutilGeneral purposehttps://nodejs.org/api/util.html
URLurlURL string parsinghttps://nodejs.org/api/url.html
QueryStringsquerystringQuery string manipulationhttps://nodejs.org/api/querystring.html
BufferbufferBinary datahttps://nodejs.org/api/buffer.html
CryptocryptoEncryption functionshttps://nodejs.org/api/crypto.html
ZLIBzlibData compression, decompressionhttps://nodejs.org/api/zlib.html

Utilities

A set of general-purpose functions that can format, encode, decode, etc.

Sample

//Utilities
const util = require("util");
const formated = util.format('%s:%s', 'foo');
//Utilities-types
const utilTypes = require("node:util/types");
const isBoolean = utilTypes.isBooleanObject(true);

URL

This is a standard module that performs string analysis of URLs.

Sample

// url
const url = require("url");
const myUrl= url.parse('https://sample@sub.example.com:8080/p/a?query=string#hash');

QueryStrings

This module handles query strings (after ? in the URL).

Sample

const querystring = require("querystring");
const querystr = querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
const queryparsed = querystring.parse('w=12344&foo=bar');

Buffer

This module handles stream objects for binary data

Sample

const buf = require("buffer");
const buffer = buf.Buffer.from('eJzT0yMAAGTvBe8=', 'base64');

Crypto

This module handles encryption functions that wrap OpenSSL. It can also be used for random number generation, etc.

Sample

const crypto = require('crypto');
const str = crypto.randomBytes(16).toString('base64').substring(0, 16); // random number generation

ZLIB

This module handles data compression and decompression in GZip and Inflate.

Sample

const zlib = require("zlib");
const content = encodeURIComponent("sample string");// encoding
const result = zlib.gzipSync(content); // compression
const value = result.toString('base64'); // Buffer => base64 conversion