How to use the memfs.Volume function in memfs

To help you get started, we’ve selected a few memfs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jenkins-infra / evergreen / distribution / client / src / lib / __mocks__ / fs.js View on Github external
'use strict';

// eslint-disable-next-line no-console
console.log('Using a memfs filesystem...');

const memfs = require('memfs');
const vol = new memfs.Volume();
const fs = memfs.createFsFromVolume(vol);

module.exports = fs;
module.exports.volume = vol;
github PolymerLabs / html-modules-toolkit / src / html-module-transform / webpack-plugin.ts View on Github external
import * as fs from 'fs';
import {Volume} from 'memfs';
import {dirname, join} from 'path';
import {Union} from 'unionfs';
import {promisify} from 'util';
import {compilation, Compiler} from 'webpack';

import {htmlModuleToJsModuleMap} from '../html-module-transform.js';

const readFile = promisify(fs.readFile);
const realpath = promisify(fs.realpath);
const ufs = new Union();
const vfs = new Volume();

ufs.use(fs).use(vfs);

const pluginName = 'HTML Modules Transform';

export interface HtmlModulesPluginOptions {
  htmlModuleTest?: (options: WebpackModuleFactoryOptions) => boolean;
}

export interface WebpackModuleFactoryOptions {
  contextInfo: {
    // The absolute path to the source file of the importing module:
    issuer: string
  };
  // The root directory of the compilation (I think.....)
  context: string;
github seagull-js / seagull / packages / mock-fs / src / mock-fs.ts View on Github external
private init() {
    this.volume = new Volume()
    this.fs = createFsFromVolume(this.volume)
    this.reset()
  }
}