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

@procedures/restic

v0.22.1

Published

The restic backup program as one procedure: backup, snapshots, restore and forget, with JSON output and no secret as input.

Readme

@procedures/restic

npm

The restic backup program as one procedure. It starts restic with argv, never through a shell.

Install

pnpm add @procedures/restic @procedures/client

A host registers the procedures with createRegistry(resticModule), or with import "@procedures/restic/register" for the global registry. The package root and ./module register nothing.

Procedures

| Procedure | Effects | What it does | | --- | --- | --- | | restic.run | reads and writes fs, network, process, destructive | Runs a restic command (backup, snapshots, restore, forget, check) and reads its JSON output. |

Example

// RESTIC_REPOSITORY and RESTIC_PASSWORD are in the environment
const { json } = await client.exec(["restic", "run"], { path: ["snapshots"] });

Secrets

restic reads the repository and its keys from the environment (RESTIC_REPOSITORY, RESTIC_PASSWORD, B2_ACCOUNT_ID, AWS_ACCESS_KEY_ID and the others), so no secret is an input. restic.run refuses --password-command, because that flag starts a program.

A host can give the secrets only to the restic process, with the env option of createResticModule() or runRestic():

  • The values go on top of the environment of the host. The value undefined removes a variable of the host.
  • The environment of the host does not change, and the output does not contain the values.
  • The procedure input has no field for them. The caller of restic.run cannot read or change them.
const registry = createRegistry(createResticModule({ env: { RESTIC_REPOSITORY: repository, RESTIC_PASSWORD: password } }));

restic can write the repository address in its error text. Remove it before you show the text to a user.

Library functions

The package root exports the functions that restic.run uses:

| Function | What it does | | --- | --- | | runRestic(command, options) | Starts a restic command with argv, and reads its JSON output. | | findRestic(options) | Finds the restic program. | | resticArgv(command) | Gives the argv of a restic command. | | createResticModule(options) | Gives the module with the settings of the host: env and run. |

  • command has path, positional, args, repository and json. json is true when the command does not set it, as in restic.run.
  • options of runRestic has executable, env, cwd, timeout, signal and run.
  • runRestic throws when restic does not start. A failed command gives success: false, with exitCode and stderr.
  • run replaces the function that starts restic. A test gives a fake runner.
  • findRestic gives RESTIC_EXE when it is set. On Windows, it then looks for the restic*.exe of a WinGet package. Then it gives restic, and the PATH gives the program.
const executable = await findRestic();
const result = await runRestic(
  { path: ["forget"], args: { "keep-daily": 14, "keep-weekly": 12, prune: true } },
  { executable, env: { RESTIC_REPOSITORY: repository, RESTIC_PASSWORD: password } },
);