Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use multiple fs modules at once

License

NotificationsYou must be signed in to change notification settings

streamich/unionfs

 
 

Repository files navigation

Creates a union of multiplefs file systems.

npm install --save unionfs

This module allows you to use multiple objects that have file systemfs API at the same time.

import{ufs}from'unionfs';import{fsasfs1}from'memfs';import*asfs2from'fs';ufs.use(fs1).use(fs2);ufs.readFileSync(/* ... */);

Use this module withmemfs andlinkfs.memfs allows you to create virtual in-memory file system.linkfs allows you to redirectfs paths.

You can also use otherfs-like objects.

import*asfsfrom'fs';import{Volume}from'memfs';import*asMemoryFileSystemfrom'memory-fs';import{ufs}from'unionfs';constvol1=Volume.fromJSON({'/memfs-1':'1'});constvol2=Volume.fromJSON({'/memfs-2':'2'});constmemoryFs=newMemoryFileSystem();memoryFs.writeFileSync('/memory-fs','3');ufs.use(fs).use(vol1).use(vol2).use(memoryFs);console.log(ufs.readFileSync('/memfs-1','utf8'));// 1console.log(ufs.readFileSync('/memfs-2','utf8'));// 2console.log(ufs.readFileSync('/memory-fs','utf8'));// 3

You can create aUnion instance manually:

import{Union}from'unionfs';varufs1=newUnion();ufs1.use(fs).use(vol);varufs2=newUnion();ufs2.use(fs).use(/*...*/);

License

Unlicense - public domain.

About

Use multiple fs modules at once

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors13


[8]ページ先頭

©2009-2025 Movatter.jp