Functions Modules

Functions modules provide collections of pre-written code that offer functionality for various tasks, serving as reusable components.

When working inside a Function these modules can be used to extend the Function's capabilities without having to write everything from scratch.

A library can be imported using the require() method.

const xhr = require(xhr); // Example of importing a library

The following modules are available in Functions:

Library NameDescription
XHR
The XHR library is used to enable the developer to send HTTP or HTTPS requests to a remote web server and load the response data back into a Function. This library is perfect for third-party authentication or triggering webhooks from a Function.
KV Store
This library allows access to the KV store. It's a persistent key value store that acts as a database for your Functions. The KV store database is globally distributed and eventually consistent. Data in the KV store is shared at a subscribe key level.
Advanced Math
Global (lat-long) coordinate and geometry Functions.
Crypto
The Crypto library provides encryption and decryption functionality in an Function.
Utils
Simple utility Functions that didn't belong anywhere else.
Codec/auth
Provides an encoder for HTTP basic auth credentials.
Codec/base64
Provides an encoder and decoder for Base64 strings.
Codec/query_string
Provides an encoder and decoder for URI query parameters.
PubNub
The PubNub library allows you to leverage many of the client SDK features supported by the PubNub Platform.
vault
Read-only database to retrieve secrets.
UUID
A library for generating RFC-compliant UUIDs in JavaScript.
JWT
A library for generating and verifying JSON Web Tokens.
JSONPath Plus
A library for analyzing, transforming, and selectively extracting data from JSON documents (and JavaScript objects).
Features not yet available in Functions

Some JavaScript features that you may expect to see, but aren't yet available in Functions:

  • Native node modules
  • async/await
  • Access to process and some other global variables
  • Ability to install third-party modules via npm
Last updated on
On this page