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

Installation

Install the SDK using npm:

npm install @fastpix/fastpix-node

Import the SDK

Import { 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:

import { Fastpix } from "@fastpix/fastpix-node";
const fastpix = new Fastpix({
  security: {
    username: "your-access-token",
    password: "secret-key",
  },
});
async function run() {
  const result = await fastpix.inputVideo.createMedia({
    inputs: [{ type: "video", url: "https://static.fastpix.io/sample.mp4" }],
    metadata: { key1: "value1" },
    accessPolicy: "public",
  });
  console.log(result);
}
run();

Once 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 index.js

NOTE

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


Full documentation

See the FastPix Node.js SDK for additional examples, API methods, and advanced usage.