Node.js SDK

Learn how the FastPix Node.js SDK enables video uploads, live streaming, and playback management in Node.js applications.

Add secure, scalable video to your Node.js project

The FastPix Node.js SDK gives you everything you need to manage video from your backend. Upload files from a public URL, attach metadata, and retrieve playback links, all without building encoding pipelines or managing storage. With this SDK, you can:

  • Upload and organize video assets
  • Define access control and metadata
  • Generate HLS playback URLs
  • Streamline video delivery from your Node.js server

Find more in the SDK reference

To explore more examples, API methods, and advanced usage, see the FastPix Node.js SDK on GitHub.


Prerequisites

Before you start using the FastPix Node.js SDK, make sure you have the following:

  1. Node.js 18 or later: This SDK is compatible with Node.js 18 or higher. We recommend using Node.js 20+ for optimal performance and the latest language features.

  2. Package manager: Ensure you have npm, yarn, or pnpm installed for dependency management.

  3. FastPix API credentials: You’ll need an Access Token and a Secret Key (HTTP Basic Auth). You can generate these credentials by following the steps in the authentication guide.

  4. Basic understanding of Node.js and REST APIs: Familiarity with Node.js development and API integration concepts.


Installation

Install the SDK using npm:

Node
1npm install @fastpix/fastpix-node

Import the SDK

Node
1Import { Fastpix } from "@fastpix/fastpix-node";

Example

Let’s create a file named index.js

This example shows how to upload a video from a public URL with metadata and public access:

Node
1import { Fastpix } from "@fastpix/fastpix-node";
2
3const fastpix = new Fastpix({
4 security: {
5 username: "your-access-token",
6 password: "your-secret-key",
7 },
8});
9
10async function run() {
11 const result = await fastpix.inputVideo.create({
12 inputs: [
13 {
14 type: "video",
15 url: "https://static.fastpix.com/fp-sample-video.mp4",
16 },
17 ],
18 metadata: {
19 "key1": "value1",
20 },
21 });
22
23 console.log(result);
24}
25
26run();

After the video is processed, you can use the media ID to fetch playback info, monitor status, or transform content via API.


Run the example

To execute the Node.js script, use the following command. Make sure to replace index.js with your actual file name if it’s different:

Node
1node index.js

NOTE

Some methods might throw errors when you are on a trial plan.