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

@nublestation/vault

v0.1.0

Published

NubleStation Vault — file storage client

Readme

@nublestation/vault

File storage SDK for NubleStation — upload, download, list, share, and control public/private access to files from your app.

npm install @nublestation/vault

Quick start

import { createVaultClient } from "@nublestation/vault";

const vault = createVaultClient({
  url:    "http://api.clinic.local",   // your NubleStation gateway
  apiKey: "nbl_<key_id>.<secret>",     // API key from the Console
});

// Upload a file to the "reports" collection
await vault.upload("reports", "q1.pdf", file);

// List everything the caller can see in that collection
const files = await vault.list("reports");

// Download raw bytes
const bytes = await vault.download("reports", "q1.pdf");

Get an API key from the Console: Apps → your app → Settings → Generate API key. The key is scoped to a single app — every request made with it is isolated to that app's files.

Collections

A collection is a flat namespace for files (think of it as a top-level folder). You choose the names — e.g. "reports", "avatars", "uploads". Files are addressed by (collection, filename).

API

createVaultClient(config) returns a client with these methods:

| Method | Returns | Description | |---|---|---| | upload(collection, filename, data) | Promise<FileResult> | Upload a Blob, Uint8Array, or ArrayBuffer. Stamped with the caller as owner. | | download(collection, filename) | Promise<ArrayBuffer> | Fetch a file's raw bytes. | | list(collection?) | Promise<FileResult[]> | Every file the caller can see, optionally scoped to one collection. | | listMine(collection?) | Promise<FileResult[]> | Files the caller owns. | | listSharedWithMe() | Promise<FileResult[]> | Files other users have shared with the caller. | | listPublic(collection?) | Promise<FileResult[]> | Public files in this app. | | setPublic(collection, filename, isPublic) | Promise<FileResult> | Toggle a file public or private. | | delete(collection, filename) | Promise<void> | Permanently delete a file and its metadata. | | share(collection, filename, granteeUserId, role) | Promise<void> | Share a file with one user as "viewer" or "editor". Pass null for filename to share the whole collection. | | unshare(collection, filename, granteeUserId) | Promise<void> | Revoke a previously created share. | | listGrants(collection, filename) | Promise<Grant[]> | List who a resource you own is shared with. |

Config

interface ClientConfig {
  url: string;     // Gateway base URL, e.g. http://api.clinic.local
  apiKey: string;  // API key issued from the Console (nbl_...)
}

Types

type GrantRole = "viewer" | "editor";

interface FileResult {
  id: string;
  ownerId: string | null;          // Identity user id of the owner
  collection: string;
  filename: string;
  mimeType: string | null;
  sizeBytes: number | null;
  isPublic: boolean;
  createdAt: string;               // ISO 8601
  role?: GrantRole | "owner" | "public";
}

interface Grant {
  granteeUserId: string;
  granteeEmail: string;
  granteeName: string | null;
  collection: string;
  filename: string | null;         // null = whole-collection grant
  role: GrantRole;
  createdAt: string;
}

Error handling

Every method throws VaultError on a non-2xx response.

import { VaultError } from "@nublestation/vault";

try {
  await vault.upload("docs", "report.pdf", bytes);
} catch (err) {
  if (err instanceof VaultError) {
    console.error(err.status, err.code); // e.g. 401 "unauthorized"
  }
}

| Code | Status | Meaning | |---|---|---| | unauthorized | 401 | API key missing, invalid, or revoked | | forbidden | 403 | The caller has no access to that file | | not_found | 404 | File or collection does not exist | | internal_error | 500 | Unexpected server error |

Browser usage

In a bundler (Vite, etc.) read config from env so the key isn't hard-coded:

const vault = createVaultClient({
  url:    import.meta.env.VITE_NUBLESTATION_URL,
  apiKey: import.meta.env.VITE_NUBLESTATION_API_KEY,
});

How it works

The SDK sends plain HTTP to api.{org}.local with an Authorization: Bearer nbl_... header. The Gateway validates the key, resolves your app, and HMAC-signs the forwarded request before it reaches Vault — your app never handles internal secrets.

License

MIT