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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cloudnest/sdk

v1.1.0

Published

The official TypeScript library for the CloudNest API

Readme

@cloudnest/sdk

NPM version Bundle Size

TypeScript library for uploading files to CloudNest API. Works in Node.js, Next.js, and browsers.

Installation

npm install @cloudnest/sdk
# or
pnpm add @cloudnest/sdk

Quick Start

import { CloudNestClient } from "@cloudnest/sdk";

const client = new CloudNestClient({
  apiUrl: "https://cloudnest.urmate.tech/api/v1",
  apiKey: "your-api-key",
});

// Upload files
const result = await client.uploadFiles(files);
console.log(result.data);

File Management

All file management methods use the same API key.

// List files owned by the API key user.
const files = await client.listFiles({
  provider: "GOOGLE_DRIVE",
  pageSize: 20,
});

// Get metadata for one file.
const file = await client.getFile("file-id");

// Get an inline preview URL for images, PDFs, text, video, and audio.
const preview = await client.getPreviewUrl("file-id");

// Audio/video helper. Use playUrl in <audio> or <video>.
const playable = await client.getPlayableUrl("file-id");

// Get a download URL without downloading bytes.
const download = await client.getDownloadUrl("file-id");

// Download bytes. In Node.js, pass destinationPath to save to disk.
await client.downloadFile("file-id", {
  destinationPath: "./downloaded-file.bin",
});

// Delete one or many files.
await client.deleteFile("file-id");
await client.deleteFiles(["file-id-1", "file-id-2"]);

Preview, Video, And MP3 Playback

const preview = await client.getPlayableUrl("file-id");

if (preview.canPlay && preview.suggestedElement === "video") {
  videoElement.src = preview.playUrl!;
  videoElement.controls = true;
}

if (preview.canPlay && preview.suggestedElement === "audio") {
  audioElement.src = preview.playUrl!;
  audioElement.controls = true;
}

Provider Uploads

await client.uploadFiles(files, {
  provider: "GOOGLE_DRIVE",
});

await client.uploadFiles(files, {
  provider: "GOOGLE_DRIVE",
  storageAccountId: "google-storage-account-id",
  providerFolderId: "google-drive-folder-id",
});

Usage Examples

Node.js - File Paths

// Upload from file path
await client.uploadFiles("/path/to/file.jpg");

// Multiple files
await client.uploadFiles(["/path/to/file1.jpg", "/path/to/file2.pdf"]);

Node.js - Buffers

import fs from "fs";

const buffer = fs.readFileSync("image.jpg");
// Add metadata to buffer
buffer.name = "image.jpg";
buffer.type = "image/jpeg";

await client.uploadFiles(buffer);

Browser/Next.js - File Objects

// From file input
const fileInput = document.querySelector('input[type="file"]');
await client.uploadFiles(fileInput.files[0]);

// Multiple files
await client.uploadFiles(Array.from(fileInput.files));

Next.js Server Actions

// app/upload/page.tsx
import { CloudNestClient } from "@cloudnest/sdk";

async function uploadAction(formData: FormData) {
  "use server";

  const client = new CloudNestClient({
    apiKey: process.env.CLOUDNEST_API_KEY!,
    isBrowser: true,
  });

  const file = formData.get("file") as File;
  const result = await client.uploadFiles(file);

  return result;
}

Supported File Types

  • Node.js: File paths (strings), Buffers
  • Browser: File objects, Blob objects
  • Next.js: File objects, Blob objects (server actions/API routes)

Error Handling

import { ValidationError, UploadError } from "@cloudnest/sdk/errors";

try {
  await client.uploadFiles(files);
} catch (error) {
  if (error instanceof ValidationError) {
    console.log("Invalid file type:", error.message);
  } else if (error instanceof UploadError) {
    console.log("Upload failed:", error.message);
  }
}

TypeScript Support

Full TypeScript support with type definitions:

import type {
  CloudNestFile,
  FilePreviewResponse,
  UploadResponseType,
} from "@cloudnest/sdk/types";

const result: UploadResponseType = await client.uploadFiles(files);

Requirements

  • Node.js: 18+
  • TypeScript: 4.5+ (optional)
  • Browsers: Modern browsers with fetch support
  • Next.js: 13+ (App Router recommended)

License

CloudNest Educational Use License. This SDK is part of the CloudNest educational project and is not production-ready. See LICENSE.