mem-fs

WebJar for mem-fs

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

mem-fs
Last Version

Last Version

1.1.3
Release Date

Release Date

Type

Type

jar
Description

Description

mem-fs
WebJar for mem-fs
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sboudrias/mem-fs

Download mem-fs

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/mem-fs/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>mem-fs</artifactId>
    <version>1.1.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/mem-fs/
implementation 'org.webjars.npm:mem-fs:1.1.3'
// https://jarcasting.com/artifacts/org.webjars.npm/mem-fs/
implementation ("org.webjars.npm:mem-fs:1.1.3")
'org.webjars.npm:mem-fs:jar:1.1.3'
<dependency org="org.webjars.npm" name="mem-fs" rev="1.1.3">
  <artifact name="mem-fs" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='mem-fs', version='1.1.3')
)
libraryDependencies += "org.webjars.npm" % "mem-fs" % "1.1.3"
[org.webjars.npm/mem-fs "1.1.3"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : through2 jar [2.0.0,3)
org.webjars.npm : vinyl jar [1.1.0,2)
org.webjars.npm : vinyl-file jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

mem-fs

Simple in-memory vinyl file store.

Usage

Loading a file

You access a file using store#get() method. If the file is in memory, it will be used. Otherwise, we'll load the file from the file-system.

var store = require('mem-fs').create();

store.get('/test/file.txt');

When trying to load a file we cannot read from disk, an empty Vinyl file will be returned. The contents of this file will be set to null.

Trying to get a directory or any invalid files will also return an empty Vinyl file pointer.

Adding/updating a file

You update file references by using store#add() method. This method take a vinyl file object as parameter.

var File = require('vinyl');
var store = require('mem-fs').create();

var coffeeFile = new File({
  cwd: '/',
  base: '/test/',
  path: '/test/file.coffee',
  contents: new Buffer('test = 123')
});

store.add(coffeeFile);

Iterating over the file system

Using store#each(cb(file, index)), you can iterate over every file stored in the file system.

Versions

Version
1.1.3