Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
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