
Security News
npm Introduces minimumReleaseAge and Bulk OIDC Configuration
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.
Creates a union of multiple fs file systems.
npm install --save unionfs
This module allows you to use multiple objects that have file system fs API at the same time.
import { ufs } from 'unionfs';
import { fs as fs1 } from 'memfs';
import * as fs2 from 'fs';
ufs.use(fs1).use(fs2);
ufs.readFileSync(/* ... */);
Use this module with memfs and linkfs.
memfs allows you to create virtual in-memory file system. linkfs allows you to redirect fs paths.
You can also use other fs-like objects.
import * as fs from 'fs';
import { Volume } from 'memfs';
import * as MemoryFileSystem from 'memory-fs';
import { ufs } from 'unionfs';
const vol1 = Volume.fromJSON({ '/memfs-1': '1' });
const vol2 = Volume.fromJSON({ '/memfs-2': '2' });
const memoryFs = new MemoryFileSystem();
memoryFs.writeFileSync('/memory-fs', '3');
ufs.use(fs).use(vol1).use(vol2).use(memoryFs);
console.log(ufs.readFileSync('/memfs-1', 'utf8')); // 1
console.log(ufs.readFileSync('/memfs-2', 'utf8')); // 2
console.log(ufs.readFileSync('/memory-fs', 'utf8')); // 3
You can create a Union instance manually:
import { Union } from 'unionfs';
var ufs1 = new Union();
ufs1.use(fs).use(vol);
var ufs2 = new Union();
ufs2.use(fs).use(/*...*/);
Unlicense - public domain.
memfs is a JavaScript implementation of an in-memory file system. It allows you to create a virtual file system that exists only in memory. Unlike unionfs, memfs does not support combining multiple file systems but is often used in conjunction with unionfs to provide in-memory file system capabilities.
mock-fs allows you to mock the file system in Node.js, making it useful for testing purposes. It provides a way to create a virtual file system with a specified structure. While it does not support combining multiple file systems like unionfs, it is useful for creating isolated file system environments for testing.
FAQs
Use multiple `fs` modules in a union.
The npm package unionfs receives a total of 720,108 weekly downloads. As such, unionfs popularity was classified as popular.
We found that unionfs 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.

Security News
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.

Security News
AI agents are writing more code than ever, and that's creating new supply chain risks. Feross joins the Risky Business Podcast to break down what that means for open source security.

Research
/Security News
Socket uncovered four malicious NuGet packages targeting ASP.NET apps, using a typosquatted dropper and localhost proxy to steal Identity data and backdoor apps.