
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@humanfs/core
Advanced tools
@humanfs/coreIf you find this useful, please consider supporting my work with a donation or nominate me for a GitHub Star.
The core functionality for humanfs that is shared across all implementations for all runtimes. The contents of this package are intentionally runtime agnostic and are not intended to be used alone.
Currently, this package simply exports the Hfs class, which is an abstract base class intended to be inherited from in runtime-specific hfs packages (like @humanfs/node).
[!WARNING] This project is experimental and may change significantly before v1.0.0. Use at your own caution and definitely not in production!
Install using your favorite package manager for Node.js:
npm install @humanfs/core
# or
pnpm install @humanfs/core
# or
yarn add @humanfs/core
# or
bun install @humanfs/core
Then you can import the Hfs and Path classes like this:
import { Hfs, Path } from "@humanfs/core";
Install using JSR:
deno add @humanfs/core
# or
jsr add @humanfs/core
Then you can import the Hfs class like this:
import { Hfs, Path } from "@humanfs/core";
It's recommended to import the minified version to save bandwidth:
import { Hfs, Path } from "https://cdn.skypack.dev/@humanfs/core?min";
However, you can also import the unminified version for debugging purposes:
import { Hfs, Path } from "https://cdn.skypack.dev/@humanfs/core";
Hfs ClassThe Hfs class contains all of the basic functionality for an Hfs instance without a predefined impl. This class is mostly used for creating runtime-specific impls, such as NodeHfs and DenoHfs.
You can create your own instance by providing an impl directly:
const hfs = new Hfs({ impl: { async text() {} }});
The specified impl becomes the base impl for the instance, meaning you can always reset back to it using resetImpl().
You can also inherit from Hfs to create your own class with a preconfigured impl, such as:
class MyHfs extends Hfs {
constructor() {
super({
impl: myImpl
});
}
}
Path ClassThe Path class represents the path to a directory or file within a file system. It's an abstract representation that can be used even outside of traditional file systems where string paths might not make sense.
const myPath = new Path(["dir", "subdir"]);
console.log(myPath.toString()); // "dir/subdir"
// add another step
myPath.push("file.txt");
console.log(myPath.toString()); // "dir/subdir/file.txt"
// get just the last step
console.log(myPath.name); // "file.txt"
// change just the last step
myPath.name = "file.json";
console.log(myPath.name); // "file.json"
console.log(myPath.toString()); // "dir/subdir/file.json"
// get the size of the path
console.log(myPath.size); // 3
// remove the last step
myPath.pop();
console.log(myPath.toString()); // "dir/subdir"
// iterate over the steps
for (const step of myPath) {
// do something
}
// create a new path from a string
const newPath = Path.fromString("/foo/bar");
Apache 2.0
FAQs
The core of the humanfs library.
The npm package @humanfs/core receives a total of 66,886,612 weekly downloads. As such, @humanfs/core popularity was classified as popular.
We found that @humanfs/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.