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

@input/pen-assets

v0.2.11

Published

In-memory asset provider for Pen

Readme

@input/pen-assets

In-memory AssetProvider test double for Pen. Not a production store.

Install

pnpm add @input/pen-assets

What It Provides

  • memoryAssets() to create an in-memory AssetProvider
  • upload, resolve, and delete behavior backed by a local object store
  • object-URL based asset refs for local development and tests
  • maxSize and onProgress implemented on upload (see below)

Usage

import { memoryAssets } from "@input/pen-assets";

const assets = memoryAssets({ maxSize: 2_000_000 });

const ref = await assets.upload(new Blob(["hello"], { type: "text/plain" }), {
  mimeType: "text/plain",
  onProgress: (progress) => {
    console.log(progress);
  },
});

const url = assets.resolve(ref);
await assets.delete(ref);

maxSize and onProgress

Both AssetUploadOptions members are implemented on this provider (not host-only stubs):

  • maxSizememoryAssets({ maxSize }) sets provider.maxSize. upload uses options.maxSize ?? provider.maxSize. An oversize file throws File size <actual> exceeds maxSize <limit> and is not stored.
  • onProgress — invoked at 0 immediately before the store write and 1 immediately after. There are no intermediate values; the upload is in-memory.

Direct upload calls (tests, playground) therefore reject oversize files the same way Pen's paste path does after it forwards these options.

delete

AssetProvider.delete is host-implemented. Pen never calls it.

This provider implements delete so hosts and tests can remove a stored ref. It does not garbage-collect unused assets across documents: Pen cannot know whether a removed block's asset is still referenced by another document, a version snapshot, or a collaborator's pending undo. Hosts own reference counting and should call delete only when their count reaches zero.

Integration Notes

  • This provider is a test double for tests, demos, and local playground flows.
  • It is not a durable production storage layer.
  • Uploaded refs are kept in memory for the lifetime of the provider instance until the host calls delete.

Options

| Option | Default | Effect | | --------------------- | ------- | ------------------------------------------------------------------------------ | | maxSize | unset | Provider-level upload cap. upload uses options.maxSize ?? provider.maxSize | | rejectUpload | unset | Failure double: throw after the size check, before onProgress or store | | rejectAfterProgress | unset | Mid-transfer double: onProgress(0), then throw without storing | | uploadUrl | unset | Store this URL instead of a blob URL. This double does not admit URLs |

onProgress is an upload option, not a factory option. This provider calls it at 0 then 1. resolve returns the stored URL or echoes ref.url for unknown refs — it is not a sanitizer.

Documentation

The docs site (the @input/pen-docs package) covers runtime floor notes on the Browser and Node page (#/support).

The public signatures of record are in api-report.md next to this package's source in the Pen repository. The docs site does not host a generated browsable reference.

License

MIT © Input B.V. See LICENSE.md.