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

@stowage/core

v0.2.0

Published

One typed API for object storage: the types every stowage adapter implements, StorageError, and the utilities an adapter calls.

Readme

@stowage/core

The types every stowage adapter implements, StorageError, and the utilities an adapter calls. It does nothing without an adapter.

Install

npm install @stowage/core

Example

A function written against Storage runs against every adapter: memoryStorage() in a test, fsStorage() on a laptop, s3Storage() or azureBlobStorage() in production.

import { isStorageError, type Storage } from "@stowage/core";

export async function readSettings(storage: Storage): Promise<unknown> {
  try {
    const object = await storage.get("settings.json");

    return await object.json();
  } catch (failure) {
    if (isStorageError(failure) && failure.code === "NotFound") return {};

    throw failure;
  }
}

Runtimes

Node 24 and later, Bun, Deno and workerd at the compatibility date 2026-09-01 without Node APIs. CI last ran green on Bun 1.4.2 and Deno 2.9.6.

The bundle measures 3.3 kB minified and gzipped.

Limits

This section is empty. @stowage/core declares no capability; each storage declares its own, out of the five names of spec 4.9.

Notes

A failure reaches the caller in one of two shapes: a StorageError, which isStorageError tells apart, or the runtime's AbortError once a signal fired (spec 4.10). A name added to StorageErrorCode or capabilityNames is a minor release, so a switch over either needs a default branch (spec 10).

import { isStorageError } from "@stowage/core";

export function describeFailure(failure: unknown): string {
  if (failure instanceof Error && failure.name === "AbortError") return "canceled";
  if (!isStorageError(failure)) throw failure;

  switch (failure.code) {
    case "NotFound":
      return "missing";
    case "AccessDenied":
    case "InvalidCredentials":
    case "Expired":
      return "refused";
    default:
      return failure.retryable ? "try again" : "failed";
  }
}

An adapter written outside this repository takes what two adapters here need on the wire from this package rather than writing it again (spec 4.13):

  • invalidKeyReason checks a key against its rule of spec 4.8, as the first act of every operation.
  • errorCodeForStatus and isTransientStatus are the status mapping of spec 4.10, and withRetry the retry loop around one request.
  • parseXml reads the XML an answer document is written in, and rejects anything outside that subset with XmlSyntaxError.
  • readEnvironment reads one environment variable, and answers "" where it is unset or the runtime cannot read it.
  • isUserMetadataKey, encodeUserMetadataValue, decodeUserMetadataValue and userMetadataByteLength carry user metadata in headers, and measure the 2 KB of spec 4.3.
  • PresignedPut is what presignPut resolves with on every adapter that declares presignedUrls.
import { invalidKeyReason, StorageError } from "@stowage/core";

export function requireWritableKey(bucket: string, key: string): void {
  const reason = invalidKeyReason(key, "writable");

  if (reason === undefined) return;

  throw new StorageError({
    code: "InvalidKey",
    message: reason,
    operation: "put",
    bucket,
    provider: "my-provider",
    key,
    attempts: 0,
  });
}

Specification

docs/spec.md at @stowage/[email protected] is the contract: a caller may rely on what it states and on nothing else this package happens to export. The terms it uses and the decisions behind it are at the same tag.

License

MIT