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

sonuslab-storage

v0.1.2

Published

Typed client SDK for SonusLab Storage — server SDK, browser uploads, Vue composable, webhook verification, and client-side encryption.

Readme

sonuslab-storage

Typed client SDK for SonusLab Storage. One package, multiple entry points: server SDK, browser uploads, framework adapters for Vue / Svelte / React, webhook verification, and client-side encryption.

API keys stay on the server. Always. The browser must never see your storage API key. Use the server SDK in your backend to mint upload URLs; the browser helper PUTs to those URLs.

Full docs: storage.sonuslab.dev/docs

Install

bun add sonuslab-storage

vue, svelte, and react are all optional peer dependencies — install only what you import.

Server

import { StorageClient } from "sonuslab-storage/server";

const storage = new StorageClient({
  apiKey: process.env.SONUSLAB_STORAGE_API_KEY!,
});

const file = await storage.upload({
  name: "report.pdf",
  contentType: "application/pdf",
  data: pdfBuffer,
});

baseUrl defaults to https://storage-api.sonuslab.dev — override only when self-hosting.

Browser

The browser hits your server, which proxies to the storage API. Two endpoints — presign + complete.

import { uploadFile } from "sonuslab-storage/client";

await uploadFile({
  file,
  presignEndpoint: "/api/upload/presign",
  completeEndpoint: "/api/upload/complete",
  onProgress: (p) => console.log(`${p.percent}%`),
});

Framework adapters

Vue

import { useUpload } from "sonuslab-storage/vue";

const { upload, status, progress, error, reset } = useUpload({
  presignEndpoint: "/api/upload/presign",
  completeEndpoint: "/api/upload/complete",
  onComplete: (r) => console.log(r.fileId),
});

A headless <StorageUpload> component is also exported. See docs/vue.

Svelte 5

import { Upload } from "sonuslab-storage/svelte";

const uploader = new Upload({
  presignEndpoint: "/api/upload/presign",
  completeEndpoint: "/api/upload/complete",
});
// uploader.status, uploader.progress, uploader.error — all runes

See docs/svelte.

React / Next.js App Router

// app/api/upload/route.ts
import { StorageClient } from "sonuslab-storage/server";
import { createUploadRoute } from "sonuslab-storage/react";

const storage = new StorageClient({ apiKey: process.env.SONUSLAB_STORAGE_API_KEY! });
export const { POST } = createUploadRoute({ storage });
"use client";
import { useUpload } from "sonuslab-storage/react";

const { upload, status, progress } = useUpload({
  presignEndpoint: "/api/upload",
  completeEndpoint: "/api/upload",
});

See docs/nextjs.

Lifecycle callbacks

Every framework adapter accepts onStart(file), onComplete(result), and onError(err) — fire-and-forget side-effects without watching status.

Client-side encryption

Opt-in AES-256-GCM via WebCrypto. Bytes are encrypted before they leave your process — the storage backend only ever sees ciphertext.

import { generateEncryptionKey } from "sonuslab-storage/crypto";

const key = generateEncryptionKey();
await storage.upload({ name, contentType, data, encrypt: { key } });

No key escrow. Lose the key, lose the data — there is no recovery path.

Passphrase mode (PBKDF2-SHA256, 100k iterations) also works:

encrypt: { key: "correct horse battery staple" }

See docs/encryption.

Webhooks

Verify against the raw request body — JSON parsing changes whitespace and breaks the signature.

import { verifyWebhook } from "sonuslab-storage/webhook";

const payload = verifyWebhook({ body, signature, secret });

See docs/webhooks.

Multipart

For files larger than ~5 MB, use multipart on the server SDK: initMultipart, presignMultipartPart, completeMultipart. See docs/multipart.

Errors

| Class | Where | Notable fields | | -------------------------- | --------------- | ------------------------- | | StorageApiError | server SDK | .status, .body | | UploadError | browser client | .cause | | WebhookVerificationError | webhook helper | — |

See docs/errors.

License

MIT