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 🙏

© 2025 – Pkg Stats / Ryan Hefner

rhachet-artifact-git

v1.1.3

Published

use git artifacts with ease

Readme

rhachet-artifact-git

test publish

use git artifacts with ease

purpose

  • use a simple, universal contract (.get, .set, .del)
  • add a pit-of-success, with best practices

install

npm install rhachet-artifact-git

use

Artifact<typeof GitFile>

get, set, del

import { genArtifactGitFile } from 'artifact-git';
import { readFile } from 'fs/promises';

const ref = { uri: '/tmp/example.txt' };
const artifact = genArtifactGitFile(ref);

// write to file
await artifact.set({ content: 'hello world' });

// read the file
const gitFile = await artifact.get();
console.log(gitFile?.content); // 'hello world'

// delete the file
await artifact.del();

null on dne

if the file does not exist yet, get will return null

const artifact = genArtifactGitFile({ uri: '/tmp/does-not-exist.txt' });

const got = await artifact.get(); // null

await artifact.set({ content: 'created now' }); // ✅ creates file

.get().expect('isPresent')

you can fail-fast if you expect the file to be present

const before = await artifact.get(); // null | GitFile
console.log(before.content) // ❌ can not read .content of possibly null

const after = await artifact.get().expect('isPresent'); // GitFile
console.log(before.content) // ✅ now typescript knows its not null

@gitroot alias

you can use the @gitroot alias in uri's, to resolve relative to the nearest git root

const artifact = genArtifactGitFile({ uri: '@gitroot/src/example.txt' });

await artifact.set({ content: 'saved under gitroot' });
// => creates file like `/your/repo/src/example.txt`

options: { access: 'readonly' | 'readwrite' }

you can safeguard content which should never be overwritten

const artifact = genArtifactGitFile(ref, { access: 'readonly' });

const got = await artifact.get(); // ✅ reads content
await artifact.set({ content: 'nope' }); // ❌ throws "readonly"
await artifact.del(); // ❌ throws "readonly"

options: { version: { retain: true } }

you can ask to retain each version of the file too

const artifact = genArtifactGitFile(ref, {
  versions true,
});

await artifact.set({ content: 'v1' });

this will ensure that each version of the artifact is also written to a meta directory, .rhachet/artifact/example.txt/*

📁 /your/repo/
│
├── 📁 .rhachet/
│   └── 📁 artifact/
│       └── 📁 example.txt
│           └── 2025-07-14T103045Z.ab12cd34ef.txt        ← this version
│
├── 📄 example.txt                                       ← this file

the version will be written in ${unidatetime}.{hash}.{ext} format

  • unidatetime so you can see when the change was effectiveAt
  • hash so you can easily see duplicate versions