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

@produck/fugue-degraded-temporary-file

v0.1.1

Published

The temporary-file degraded medium for @produck/fugue: it names its own file under the OS temporary directory.

Downloads

341

Readme

@produck/fugue-degraded-temporary-file

The temporary-file degraded medium for @produck/fugue, built on @produck/fugue-degraded-node-file.

The distributor spills to a medium once its stash grows past MaxChunkStashByteLength. This package is that medium for a host with no opinion about where the spool goes: it names its own file under the OS temporary directory, and the release removes it, so nothing of the spool is left behind.

The framing, the two classes and the release rules are the sibling's — this package decides the path, and nothing else.

Install

npm install @produck/fugue-degraded-temporary-file

Use

import * as Fugue from '@produck/fugue';
import { ChunkReader } from '@produck/fugue-degraded-temporary-file';

const { DEGRADED_CHUNK_READER_CTOR } = Fugue.SYMBOL.DISTRIBUTOR._S;

class UploadDistributor extends Fugue.Distributor {
  static get [DEGRADED_CHUNK_READER_CTOR]() {
    return ChunkReader;
  }
}

const distributor = new UploadDistributor(source);

Fugue.Options.Tune.MaxChunkStashByteLength(distributor, 64 * 1024 * 1024);

const copy = distributor.fork();
  • Nothing to configure: the medium takes no transferrer arguments, so there is no setTransferrerArgs() call to make.
  • The path is os.tmpdir() plus what the class answers from generateFileName(): fugue-<uuid>.tmp by default, picked when the medium is built, so concurrent distributors never collide. The medium's pathname tells you which one it got.
  • Nothing is written until the stash crosses MaxChunkStashByteLength.
  • destroy() releases the medium: the handle is closed and the file is removed.

The two classes

  • TemporaryFileTransferrer — the write side: a FileTransferrer whose constructor names its own file through generateFileName(), and whose argument hook answers no arguments.
  • TemporaryFileChunkReader — the read side, one instance per copy.

Both are also exported as ChunkReader and Transferrer — the pair every degraded/<kind> package answers.

To name the file differently, override the namer. The constructor reads it from the class being built, so a subclass needs nothing else. The answer must be a relative path that names something inside the temporary directory — not absolute, not climbing out with .., and not the directory itself — or the medium refuses it:

import { Transferrer } from '@produck/fugue-degraded-temporary-file';

class ArchivedTransferrer extends Transferrer {
  static generateFileName() {
    return `archive-${crypto.randomUUID()}.spool`;
  }
}

Scope

Node only: os.tmpdir() and node:crypto pick the default name, node:fs writes the file. A host that wants the spool outside the temporary directory, or wants to keep it, should use the sibling instead: @produck/fugue-degraded-node-file.

License

MIT