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

@auto-engineer/file-store

v1.130.0

Published

Platform-agnostic file storage abstraction with in-memory and Node.js implementations.

Readme

@auto-engineer/file-store

Platform-agnostic file storage abstraction with in-memory and Node.js implementations.


Purpose

Without @auto-engineer/file-store, you would have to write platform-specific file operations, handle path normalization across operating systems, and create separate test implementations for file-dependent code.

This package provides unified interfaces for file system operations. The in-memory implementation enables testing without touching the disk, while the Node.js implementation handles real file operations with automatic directory creation.


Installation

pnpm add @auto-engineer/file-store

Quick Start

import { InMemoryFileStore } from '@auto-engineer/file-store';

const store = new InMemoryFileStore();

await store.write('/data/file.txt', new TextEncoder().encode('content'));
const data = await store.read('/data/file.txt');

console.log(new TextDecoder().decode(data!));
// → "content"

How-to Guides

Use In-Memory Store for Testing

import { InMemoryFileStore } from '@auto-engineer/file-store';

const store = new InMemoryFileStore();
await store.write('/input.txt', new TextEncoder().encode('data'));

const exists = await store.exists('/input.txt');
const tree = await store.listTree('/');

Use Node Store for Production

import { NodeFileStore } from '@auto-engineer/file-store/node';

const store = new NodeFileStore();

await store.writeText('config.json', JSON.stringify({ key: 'value' }));
const text = await store.readText('config.json');

List Directory Tree

import { NodeFileStore } from '@auto-engineer/file-store/node';

const store = new NodeFileStore();
const tree = await store.listTree('/project', {
  pruneDirRegex: /node_modules|\.git/,
  includeSizes: true,
});

Dependency Injection

import type { IFileStore } from '@auto-engineer/file-store';

class DocumentManager {
  constructor(private store: IFileStore) {}

  async save(id: string, content: string): Promise<void> {
    await this.store.write(`/docs/${id}.json`, new TextEncoder().encode(content));
  }
}

API Reference

Package Exports

import { InMemoryFileStore, type IFileStore, type IExtendedFileStore } from '@auto-engineer/file-store';

import { NodeFileStore } from '@auto-engineer/file-store/node';

Entry Points

| Entry Point | Import Path | Description | |-------------|-------------|-------------| | Main | @auto-engineer/file-store | Platform-agnostic (InMemoryFileStore, types) | | Node | @auto-engineer/file-store/node | Node.js-specific (NodeFileStore) |

IFileStore Interface

interface IFileStore {
  write(path: string, data: Uint8Array): Promise<void>;
  read(path: string): Promise<Uint8Array | null>;
  exists(path: string): Promise<boolean>;
  listTree(root?: string, opts?: ListTreeOptions): Promise<TreeEntry[]>;
  remove(path: string): Promise<void>;
}

IExtendedFileStore Interface

interface IExtendedFileStore extends IFileStore {
  ensureDir(path: string): Promise<void>;
  readdir(path: string): Promise<DirEntry[]>;
  readText(path: string): Promise<string | null>;
  writeText(path: string, text: string): Promise<void>;
  join(...parts: string[]): string;
  dirname(p: string): string;
  fromHere(relative: string, base?: string): string;
}

ListTree Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | followSymlinkDirs | boolean | true | Traverse symlinked directories | | includeSizes | boolean | true | Include file sizes | | pruneDirRegex | RegExp | - | Skip matching directories |


Architecture

src/
├── index.ts
├── node.ts
├── types.ts
├── path.ts
├── InMemoryFileStore.ts
└── NodeFileStore.ts

Key Concepts

  • Binary-first API: Core operations use Uint8Array for compatibility
  • Null over exceptions: Read returns null for missing files
  • POSIX normalization: All paths use forward slashes
  • Auto directory creation: Write creates parent directories

Dependencies

This package has zero external dependencies. It uses only Node.js built-in modules.