Skip to content

Node.js - Locally Spawned Instance

LocallySpawnedInstanceManager allows you to create a new Smelter instance that will download a smelter binaries and start a new server on the local machine.

This is a default manager for smelter on Node.js.

Reference

LocallySpawnedInstanceManagerExample.tsx
import Smelter, { LocallySpawnedInstanceManager } from "@swmansion/smelter-node"
async function run() {
const manager = new LocallySpawnedInstanceManager({
port: 8000
});
const smelter = new Smelter(manager);
await smelter.init()
}
void run();

ExistingInstanceOptions

Type definitions

type LocallySpawnedInstanceOptions = {
port: number;
workingdir?: string;
executablePath?: string;
enableWebRenderer?: boolean;
};

Properties

port

Port number where smelter API endpoint is exposed.

  • Type: number

workingdir

Working directory that smelter instance will use:

  • For temporary downloads. See SMELTER_DOWNLOAD_DIR.

  • To resolve relative paths for options that accept paths.

  • As a CWD of a smelter process.

  • Type: string


executablePath

Path to the compositor executable. If provided compositor will use that instead of downloading official binaries.

  • Type: string

enableWebRenderer

This option affects whether Web Renderer functionality will be enabled.

  • Based on that value appropriate compositor binaries are downloaded (with or without web rendering support).

  • It configures SMELTER_WEB_RENDERER_ENABLE environment variable.

  • Type: boolean

  • Default value: false