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

@bearz/fs

v0.1.0

Published

The fs module provides a modern file system API that works in Deno, Bun, and NodeJs to promote creating cross-runtime packages/modules

Readme

@bearz/fs

Overview

The fs module provides a modern file system API that works in Deno, Bun, and NodeJs to promote creating cross-runtime packages/modules for TypeScript/JavaScript.

logo

JSR npm version GitHub version

Documentation

Documentation is available on jsr.io

A list of other modules can be found at github.com/bearz-io/js

Usage

import { makeDir, writeTextFile, remove } from "@bearz/fs"


await makeDir("/home/my_user/test");
await writeTextFile("/home/my_user/test/log.txt",  "ello");
await remove("/home/my_user/test", { recursive: true });

Classes

  • AlreadyExistsError - An error thrown when a file already exists.
  • FsFile - The type returned by open and openSync.
  • NotFoundError - An error thrown when a file or directory is not found.

Functions

  • chmod & chmodSync - Changes the mode for the given file or directory on a posix system.
  • chown & chownSync - Changes the owner for the given file or directory on a posix system.
  • copyFile & copyFileSync - Copies a file from the current path to the desintation.
  • copy & copySync - Copies a file, directory, or symlink to the destination.
  • cwd - Gets the current working directory.
  • emptyDir & emptyDirSync - Clears all the child items in a directory.
  • ensureDir & ensureDirSync - Ensure that a directory exists or is created if needed.
  • ensureFile & ensureFileSync - Ensure that a file exits or is created if needed.
  • ensureSymlink & ensureSymlinkSync - Ensures that a symlink exists or is created if needed.
  • exists & existsSync - Determines if a file or directory exists.
  • isNotFoundError - Determines if an error is NotFoundError, NotFound, or node error with a code of ENOENT.
  • isAlreadyExistsError - Determines if an error is an AlreadyExistsError, AlreadyExists, or node error with a code of EEXIST.
  • expandGlob & expandGlobSync - Gets files and/or directories that matches the glob against the root direcory provided. root directory defaults to the current working directory.
  • gid - Gets the group id for the current user for the process (posix only).
  • isDir & isDirSync - Determines if a path exists and is a directory.
  • isFile & isFile - Determines if a path exists and is a file.
  • link & linkSync - Creates a hard link.
  • lstat & lstatSync - Invokes link stat on path to get system system information.
  • makeDir & makeDirSync - Creates a new directory.
  • makeTempDir & makeTempDirSync - Creates a new temporary directory.
  • makeTempFile & makeTempFileSync - Creates a new temporary file.
  • move & moveSync - Moves a file, directory, or symlink to the destination.
  • open & openSync - Opens a file and returns an instance of FsFile which includes multiple methods of working with a file such as seek, lock, read, write, stat, etc. Reand and write only reads/writes a chunk of data is more akin to to a stream.
  • readDir & readDirSync - Reads a directory and returns an iterator of DirectoryInfo. This is not recursive.
  • readFile & readFileSync - Reads the data of a file as Uint8Array (binary).
  • readLink & readLinkSync - Reads the link and gets source path.
  • readTextFile & readTextFile - Reads a file that is utf-8 and returns the contents as a string.
  • remove & removeSync - Deletes a directory, file, or symlink from the file system.
  • rename & renameSync - Renames a directory, file, or symlink.
  • stat & statSync - Gets a file or directories file system information.
  • symlink & symlinkSync - Creates a new symlink (soft) link.
  • uid - Gets the user id for the current user of the process. (posix only).
  • utime & utimeSync - Changes the creation and modfication dates for a file or directory.
  • walk & walkSync - Iterates over a directory structure recursively.
  • writeFile & writeFileSync - Writes Uint8Array (binary) to a given file path.
  • writeTextFile & writeTextFileSync - Writes a string to a given file path as utf-8 encoded data.

Notes

The API is heavily influenced by Deno's file system APIs which are built on modern web standards which includes promises, iterator, and async iterator did not exist in node when the api was created. This module gets rid of the need to import "fs/promises".

The module will still load functions if called from the browser or runtimes outside of node, bun, and deno. However, the functions will throw errors when called.

To use the lock and seek methods on the File object returned from the open method in runtimes outside of Deno, you'll need to implement the methods by importing @bearz/fs/ext and setting the methods.

This was done to avoid a hard dependency on npm's fs-extra module. An additional bearz module may be created at a later date to handle that.

The module includes the same functions found in deno's @std/fs module but instead of only supporting deno file system calls, it uses the this module's abstraction layer which supports deno, bun, and node.

License

MIT License

Deno MIT License