npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@shocknet/seedsdk

v1.0.20

Published

TypeScript SDK for LN.video file storage with resumable uploads, video transcoding, thumbnail generation, and CDN delivery

Readme

Seed SDK

A TypeScript SDK for uploading, managing, and serving files on LN.video - a simple, fast file storage and CDN service with built-in video transcoding and thumbnail generation.

Features

  • 📤 Resumable uploads - Never lose progress on large file uploads
  • 🎬 Video transcoding - Automatic conversion to optimized mp4 format
  • 🖼️ Thumbnail generation - Create video thumbnails automatically
  • 🔒 Private files - Secure files with presigned URLs
  • 📊 Upload progress tracking - Real-time progress callbacks
  • 🗂️ File management - List and delete files from your bucket
  • 🚀 CDN delivery - Fast global content delivery

Installation

npm i @shocknet/seedsdk

Quick Start

import SeedSDK from '@shocknet/seedsdk'

// Initialize SDK with your API token and Seed URL
const sdk = new SeedSDK("your_api_token", "https://your-ingest-instance.ln.video")

// Upload a file
const url = await sdk.uploadFilePath("./video.mp4", "my-video.mp4", true)
console.log("File uploaded:", url)

API Reference

Constructor

new SeedSDK(apiKey: string, apiUrl: string)

Initialize the SDK with your publish token and Seed API URL.

Upload Methods

uploadFilePath(path, finalName, isPrivate?)

Upload a single file from the file system.

const url = await sdk.uploadFilePath(
  "./path/to/file.mp4",
  "final-name.mp4",
  true // isPrivate (default: true)
)

Returns: Promise resolving to the file URL

publish(data)

Advanced upload with multiple files, progress tracking, and transcoding.

const file1 = await sdk.readFile("file1.mp4")
const file2 = await sdk.readFile("file2.avi")

const urls = await sdk.publish({
  items: [
    { 
      file: file1, 
      isPrivate: true, 
      finalName: "video1.mp4" 
    },
    { 
      file: file2, 
      isPrivate: false, 
      finalName: "video2.mp4",
      transcode: true // Convert to optimized mp4
    }
  ],
  onGlobalProgress: (progress) => {
    Object.keys(progress).forEach(key => {
      const { sent, total, eta } = progress[key]
      console.log(`${key}: ${sent}/${total} bytes (ETA: ${eta}s)`)
    })
  },
  needSeedThumbns: true,
  gotThumbnail: (thumbnails) => {
    thumbnails.forEach(t => console.log(`Thumbnail: ${t.name} -> ${t.uri}`))
  }
})

Parameters:

  • items - Array of files to upload with configuration
  • onGlobalProgress - Callback for upload progress
  • needSeedThumbns - Generate thumbnails for videos
  • gotThumbnail - Callback when thumbnails are ready

Returns: Promise resolving to array of file URLs

File Management

listFiles()

List all files in your bucket.

const files = await sdk.listFiles()
// Returns: [{ filename: string, src: string }, ...]

files.forEach(file => {
  console.log(`${file.filename}: ${file.src}`)
})

Returns: Promise resolving to array of file objects with filename and src

deleteFile(filename)

Delete a file from your bucket.

const result = await sdk.deleteFile("video.mp4")
if (result.ok) {
  console.log("File deleted successfully")
} else {
  console.error("Error:", result.error)
}

Returns: Promise resolving to { ok: true } or { error: string }

URL Generation

presignUrl(filename, expiresInSeconds)

Generate a time-limited presigned URL for a private file.

const expiresIn = 60 * 60 * 24 * 30 // 30 days
const presignedUrl = await sdk.presignUrl("private-video.mp4", expiresIn)
console.log("Access URL:", presignedUrl)

Returns: Promise resolving to presigned URL string

Utilities

readFile(filename)

Read a file from the file system (used internally for uploads).

const file = await sdk.readFile("./local-file.mp4")
// Returns a File object ready for upload

Returns: Promise resolving to File object

Examples

Video Transcoding

Automatically transcode videos to optimized mp4 format:

const file = await sdk.readFile("source.avi")

await sdk.publish({
  items: [
    { 
      file, 
      isPrivate: false, 
      finalName: "optimized.mp4",
      transcode: true // Converts to 1080p mp4
    }
  ]
})

Managing Private Files

Upload private files and generate temporary access URLs:

// Upload private file
await sdk.uploadFilePath("./private.pdf", "document.pdf", true)

// Generate 1-hour access link
const accessUrl = await sdk.presignUrl("document.pdf", 3600)

// Share the temporary URL
console.log("Share this link:", accessUrl)

Batch Operations

Upload multiple files with progress tracking:

const files = ["video1.mp4", "video2.mp4", "image.jpg"]
const fileObjects = await Promise.all(
  files.map(f => sdk.readFile(f))
)

await sdk.publish({
  items: fileObjects.map((file, i) => ({
    file,
    isPrivate: false,
    finalName: `media-${i}.${file.name.split('.').pop()}`
  })),
  onGlobalProgress: (progress) => {
    const totalSent = Object.values(progress).reduce((sum, p) => sum + p.sent, 0)
    const totalSize = Object.values(progress).reduce((sum, p) => sum + p.total, 0)
    console.log(`Overall: ${(totalSent/totalSize*100).toFixed(1)}%`)
  }
})

Cleanup Old Files

List and delete files from your bucket:

// Get all files
const files = await sdk.listFiles()

// Delete files
for (const file of files) {
  console.log(`Deleting ${file.filename}...`)
  await sdk.deleteFile(file.filename)
}

TypeScript Support

This package is written in TypeScript and includes full type definitions out of the box.

Module Format

This package is an ES Module. Make sure your project is configured to use ES modules (e.g., "type": "module" in package.json).

License

ISC