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

@firpy/type-fs

v0.1.4

Published

TypeScript types for file system operations

Readme

type-fs

npm github-repo License: MIT

A file system parser and validator with full type inference. Inspired by Zod.

Features

  • Type Inference - Schemas automatically infer TypeScript types from file system structures
  • Schema Composition - Combine primitives with unions, arrays, and objects
  • Validation - Parse and validate files and directories with detailed error reporting
  • Discriminated Unions - Type-safe handling of multiple schema variants

Installation

npm install @firpy/type-fs

Quick Start

import { typefs, safePath } from "@firpy/type-fs";

// Define a schema for image files
const imageSchema = typefs.image("public/");

// Parse a file and get type-safe results
async function main() {
  const result = await imageSchema.parse(safePath("public/photo.jpg"));

  if (result.wasResultSuccessful) {
    // TypeScript knows the exact shape!
    console.log(result.okValue.width, result.okValue.height);
  }
}

Examples

Video or image

//Matches either an image inside the "public/" folder or a .url file
const videoOrImageSchema = typefs.union(typefs.image("public/"), typefs.url());

async function example() {
  const parseResult = await videoOrImageSchema.parse(safePath("video.url"));
  if (parseResult.wasResultSuccessful) {
    //Inferred as a discriminated union of Image and Url
    const videoOrImage = parseResult.okValue;

    if (videoOrImage.option === 0) {
      /* Both are inferred as numbers because
      videoOrImage.value is inferred as an Image */
      const [width, height] = [
        videoOrImage.value.width,
        videoOrImage.value.height,
      ];

      console.log(width, height);
    } else {
      //videoOrImage.value is inferred as a Url
      const videoUrl = videoOrImage.value.url;

      console.log(videoUrl);
    }
  }
}

Video collection

//matches a folder named "videos" that contains .url files
const videoUrls = typefs.array(typefs.url()).withName("videos");

async function example() {
  const video = await videoUrls.parse(safePath("videos"));

  if (video.wasResultSuccessful) {
    //Inferred as Url[]
    const videoUrls = video.okValue.parsed;

    videoUrls.map((url) => console.log(url.url));
  }
}

Why?

I wanted a file system parser that defines a single source of truth for file system entities. Schemas and validators are inferred from this source of truth, so requirements changes automatically propagate to type-safe validators. This is similar to how Zod works. I could've used io-ts, but I wanted full control over schema primitives and parsing logic.

How?

This package uses TypeScript's type inference to infer a schema's output type from the schema itself by recursively traversing the schema and inferring its properties' types.

Status

This package is under active development. Expect breaking changes between minor versions. It's being used in production for file-based content management systems.