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

@warlock.js/fs

v4.1.15

Published

Filesystem primitives for Warlock.js — drop-in replacement for @warlock.js/fs.

Readme

@warlock.js/fs

A pocket-sized filesystem toolkit for Node — the shape you wish node:fs/promises had, without pulling in fs-extra, rimraf, mkdirp, write-file-atomic, and hasha. Standalone: usable in any Node project, no @warlock.js/core required.

Every helper picks the right defaults — writes create parent directories for you, deletes swallow ENOENT, atomicWriteAsync writes-then-renames, and hashFileAsync streams so a 1 GB file doesn't blow the heap.

Install

yarn add @warlock.js/fs
# or
npm install @warlock.js/fs

One naming convention

That's the whole vocabulary:

  • *Async returns a Promise — use it in server / runtime code.
  • bare name is synchronous — use it in CLI tools, codegen, and one-shot scripts.

One canonical name per operation; no aliases to remember. If the obvious name isn't there, the operation isn't there.

30-second tour

import {
  putJsonFileAsync,
  getJsonFileAsync,
  atomicWriteAsync,
  ensureDirectoryAsync,
  listFilesAsync,
  hashFileAsync,
} from "@warlock.js/fs";

// Write JSON (parent dirs auto-created, pretty-printed at 2 spaces)
await putJsonFileAsync("./build/manifest.json", { version: "1.0.0" });

// Read it back, typed
const manifest = await getJsonFileAsync<{ version: string }>("./build/manifest.json");

// Atomic write — concurrent readers never see a half-written file
await atomicWriteAsync("./build/state.lock", manifest.version);

// Directory ops
await ensureDirectoryAsync("./build/cache");
const files = await listFilesAsync("./build"); // full paths, not bare names

// Content fingerprint (streaming — constant memory)
const digest = await hashFileAsync("./build/manifest.json");

What you get

  • Read + write text and JSONgetFileAsync, getJsonFileAsync, putFileAsync, putJsonFileAsync. Writes auto-create parent directories; JSON variants pretty-print at 2-space indent.
  • Atomic writesatomicWriteAsync (accepts string | Buffer) and atomicWriteJsonAsync, for files other processes read concurrently.
  • Directory managementensureDirectoryAsync, list(Async) / listFiles(Async) / listDirectories(Async), copyFile(Async) / copyDirectory(Async), renameFile(Async).
  • Deleteunlink(Async) and removeDirectory(Async), both ENOENT-safe (no-op on missing targets).
  • Content hashinghashFileAsync (streaming), hashFileSmallAsync, hashString, hashBuffer. SHA-256 default; sha1 / md5 / sha512 supported.
  • Existence + statspathExists, fileExists, directoryExists, lastModified, stats (each with an *Async twin).

Full documentation

The complete guide — getting started, essentials, task guides, recipes, and API reference — lives at warlock.js.org.

Tests

This package uses Vitest:

yarn test

License

MIT