Node.js Complete Reference Index

Select any item below to open its full syntax specification, parameters, and live example.

Node.js Tutorial

Globals

4 entries

Architecture

1 entry

Observability

1 entry

Async context

2 entries

MongoDB

1 entry

Security

2 entries
Authorization policydecide(principal, action) → status (lesson-defined policy)
Authentication establishes who is making a request. Authorization decides whether that identity may perform a particular action. A signed-in reader can be allowed to view the catalog while being forbidden to change its prices. Always make the permission decision on the server, using an identity established by trusted authentication middleware. Never accept a role or user ID from a request body as proof of identity. An authenticated user is not automatically an administrator. A hidden button is not a server-side permission check. Evidence: local teaching fixture, not a production security guarantee. Source: https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html
Browser security boundariescors(origin) → response headers (lesson-defined policy)
CORS governs whether a browser allows scripts from another origin to access a response. CSRF protection addresses unwanted actions made through a browser carrying a user’s credentials. They solve different problems, and neither replaces server-side permission checks. Do not treat an omitted CORS header as denial of a server-side action. Non-browser clients do not enforce browser CORS. Do not reflect arbitrary Origin values or treat HttpOnly as a CSRF prevention mechanism. Evidence: local teaching fixture, not a production security guarantee. Source: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html

Runtime

1 entry

Buffer

8 entries
Buffer base64url encodingBuffer.from(text, 'base64url'); bytes.toString('base64url')
Encodes bytes using the URL-safe Base64 alphabet without output padding. This is reversible encoding, not secrecy or integrity. Tested on Node.js 22.16.0. Example output (one line per entry): ["-_8 true"].
Buffer.alloc()Buffer.alloc(size[, fill[, encoding]])
Creates initialized byte storage; the default contents are zero. Tested on Node.js 22.16.0. Keep allocation sizes bounded; prefer initialized storage over allocUnsafe for beginner code.
Buffer.byteLength()Buffer.byteLength(string[, encoding])
Counts bytes required by an encoding rather than JavaScript UTF-16 code units. Tested on Node.js 22.16.0. For malformed hex or base64 text the count need not match decoding; validate input separately.
Buffer.concat()Buffer.concat(list[, totalLength])
Combines byte arrays into new storage in the supplied order. Tested on Node.js 22.16.0. A supplied length can truncate or zero-pad; avoid concatenating unbounded request bodies.
Buffer.copy()source.copy(target[, targetStart[, sourceStart[, sourceEnd]]])
Copies bytes into a destination buffer. Unlike subarray, the destination does not share the copied region when separately allocated. Tested on Node.js 22.16.0. Example output (one line per entry): ["2 oo", "book"].
Buffer.equals()buf.equals(otherBuffer)
Checks whether two byte sequences have identical contents. Tested on Node.js 22.16.0. Do not use ordinary equality comparison as a constant-time cryptographic verification primitive.
Buffer.from(string)Buffer.from(string[, encoding])
Encodes a string into a Buffer. UTF-8 is the default. Other overloads accept arrays, buffers and ArrayBuffers with different copy/sharing semantics.
Buffer.isBuffer()Buffer.isBuffer(obj)
Distinguishes Node Buffer instances from ordinary typed arrays and other values. Tested on Node.js 22.16.0. Use it only when the Buffer-specific interface matters; Uint8Array is also valid for many APIs.

Showing 20 of 490 entries