Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Added custom file system API #489

Merged
merged 1 commit into from
Nov 29, 2022
Merged

Conversation

XmiliaH
Copy link
Collaborator

@XmiliaH XmiliaH commented Nov 22, 2022

Add a file system API to support file system such as memfs.
Can be used like:

const {NodeVM, VMFileSystem} = require('vm2');
const memfs = require('memfs');

const fs = new VMFileSystem({fs: memfs});

const vm = new NodeVM({require: {fs: fs}});

@XmiliaH XmiliaH merged commit 81f625d into patriksimek:master Nov 29, 2022
@elglogins
Copy link

An example of how to use this, with f.x. running a script, that requires a relative path module file. Would be great.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

how require file from memfs in vm2? Documentation for customRequire option
2 participants