Modules and libraries
This page lists every built-in JavaScript module available inside a PubNub Function. For conceptual guidance on the runtime and its trigger types, see Functions. For per-execution operation caps (XHR requests, KV store operations, PubNub API calls, chain depth), see API limits.
Load a module with require(). No package installation step is needed. The Functions runtime does not support native Node.js modules, npm packages, the process global, or WebSocket connections. See Built-in modules for what the runtime supports instead.
| Module | require() name | Description |
|---|---|---|
| kvstore | kvstore | Persistent key-value store scoped to your subscribe key. |
| xhr | xhr | Outbound HTTP and HTTPS requests. |
| pubnub | pubnub | PubNub client SDK capabilities and Functions-specific publishing methods. |
| crypto | crypto | Hashing, HMAC, signing, and verification. |
| vault | vault | Read-only access to secrets stored on your keyset. |
| jwt | jwt | Creates and verifies JSON Web Tokens. |
| uuid | uuid | Generates RFC-compliant UUIDs. |
| codec | codec/auth, codec/base64, codec/query_string | Basic Auth headers, Base64, and query-string encoding and decoding. |
| jsonpath-plus | jsonpath | Queries JSON documents and JavaScript objects with JSONPath expressions. |
| advanced_math | advanced_math | Distance calculation and degrees-to-radians conversion. |
| utils | utils | Random integer generation and numeric type checking. |
| ugc | ugc | Moderates user-generated content inline against an Auto Moderation configuration. |
Related reference
- Functions. What each trigger type does and when to use it.
- Function types. Per-trigger reference for every Function type.
- Request and response objects. Every field and method on the
request,response, andeventobjects a handler receives. - API limits. Per-execution operation caps, including XHR requests, KV store operations, PubNub API calls, and chain depth.