unionfs
Use multiple `fs` modules in a union.
Last updated 7 years ago by streamich .
Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install unionfs 
SYNC missed versions from official npm registry.

unionfs

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(/*...*/);

License

Unlicense - public domain.

Current Tags

  • 4.5.1                                ...           latest (2 years ago)

26 Versions

  • 4.5.1                                ...           2 years ago
  • 4.5.0                                ...           2 years ago
  • 4.4.0                                ...           5 years ago
  • 4.3.2                                ...           5 years ago
  • 4.3.1                                ...           5 years ago
  • 4.3.0                                ...           5 years ago
  • 4.2.1                                ...           5 years ago
  • 4.2.0                                ...           6 years ago
  • 4.1.0                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 3.0.2                                ...           7 years ago
  • 3.0.1                                ...           7 years ago
  • 2.0.7                                ...           7 years ago
  • 2.0.4                                ...           7 years ago
  • 2.0.3                                ...           7 years ago
  • 2.0.2                                ...           7 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 0.0.9                                ...           9 years ago
  • 0.0.8                                ...           9 years ago
  • 0.0.6                                ...           9 years ago
  • 0.0.5                                ...           9 years ago
  • 0.0.4                                ...           9 years ago
  • 0.0.3                                ...           9 years ago
  • 0.0.2                                ...           9 years ago
  • 0.0.1                                ...           9 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (14)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |