Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including safevm with all npm packages installed. Try it out:

var safevm = require("safevm")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

safevm v1.3.5

Safe Sandboxed VM

Safe secure Sandboxed VM for code.

    const safevm = require('safevm');

    result = safevm( // result is the module.exports
        function () {
            // string or function of code to be run safely
        [{ output: console.log }],
            // array of context/globals, default use is the first or a new object
        { filename: "" }
            // Options from with a few added options like dirname, globalIndex, onError, etc.

    result = safevm(require("fs").readFileSync("path/to/file.js"), {}, { filename: "vm.js"});


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free