Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arc-fs

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arc-fs

<img src="https://img.shields.io/github/license/eBay/ar

  • 2.0.6
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

arc-fs

ebay open source MIT licensed travisci build Codecov npm version downloads

Wrap a filesystem to provide a read-only fs api that adapts files according to an active flagset

API

new AdaptiveFS(options);

  • options.fs (optional): a filesystem that conforms to the node.js fs api. Defaults to the built-in fs module
  • options.flags (required): an Object where each key represents a flag and the value is a boolean indicating whether that flag is active or Array of strings that represent the active flags

Instance methods

resolveSync(path)

Returns the resolved path based on the active flagset

getMatchesSync(path)

Returns a MatchSet for the path

isAdaptiveSync(path)

Returns a boolean indicating if the path can be adapted

clearCache()

Clears the adaptive resolver's cache

Read methods from fs
  • stat
  • statSync
  • readdir
  • readdirSync
  • readFile
  • readFileSync
  • readlink
  • readlinkSync
  • exists
  • existsSync

Examples

Default filesystem

import fs from 'fs';
import AdaptiveFS from 'arc-fs';

const afs = new AdaptiveFS({ flags:['test'] });

fs.writeFileSync('message[test].txt', 'Hello Test');
afs.readFileSync('message.txt'); // Hello Test

In-Memory filesystem

import MemoryFS from 'memory-fs';
import AdaptiveFS from 'arc-fs';

const mfs = new MemoryFS();
const afs = new AdaptiveFS({ fs:mfs, flags:['test'] });

mfs.writeFileSync('message[test].txt', 'Hello Test');
afs.readFileSync('message.txt'); // Hello Test

FAQs

Package last updated on 03 Jun 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc