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
XHRThe 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 StoreThis 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 MathGlobal (lat-long) coordinate and geometry Functions.
CryptoThe Crypto library provides encryption and decryption functionality in an Function.
UtilsSimple utility Functions that didn't belong anywhere else.
Codec/authProvides an encoder for HTTP basic auth credentials.
Codec/base64Provides an encoder and decoder for Base64 strings.
Codec/query_stringProvides an encoder and decoder for URI query parameters.
PubNubThe PubNub library allows you to leverage many of the client SDK features supported by the PubNub Platform.
vaultRead-only database to retrieve secrets.
UUIDA library for generating RFC-compliant UUIDs in JavaScript.
JWTA library for generating and verifying JSON Web Tokens.
JSONPath PlusA 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