Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

SDK Getting Started

Install and initialize the Pinner SDK.

Prerequisites

Installation

SDK Installation

pnpm

pnpm add @lumeweb/pinner

npm

npm install @lumeweb/pinner

yarn

yarn add @lumeweb/pinner

Basic Initialization

import { Pinner } from "@lumeweb/pinner"; const pinner = new Pinner({ jwt: "YOUR_API_TOKEN" });

Your First Upload

Basic Upload Pattern

import { Pinner } from "@lumeweb/pinner"; const pinner = new Pinner({ jwt: "YOUR_API_TOKEN" }); const file = new File(["Hello, Pinner!"], "hello.txt", { type: "text/plain" }); const result = await pinner.uploadAndWait(file); console.log("CID:", result.cid); console.log("Name:", result.name); console.log("Size:", result.size, "bytes");

TypeScript Configuration

import { Pinner, PinnerConfig } from "@lumeweb/pinner"; const config: PinnerConfig = { jwt: "YOUR_API_TOKEN", endpoint: "https://api.pinner.xyz" }; const pinner = new Pinner(config);