Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@edge-runtime/vm

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@edge-runtime/vm

Low level bindings for creating Web Standard contexts.

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
933K
increased by12.75%
Maintainers
1
Weekly downloads
 
Created

What is @edge-runtime/vm?

@edge-runtime/vm is a Node.js package that provides a runtime environment for executing JavaScript code in a secure and isolated context. It is particularly useful for edge computing scenarios where you need to run code close to the data source with minimal latency.

What are @edge-runtime/vm's main functionalities?

Execute JavaScript Code

This feature allows you to execute arbitrary JavaScript code within a secure and isolated virtual machine context.

const { EdgeVM } = require('@edge-runtime/vm');
const vm = new EdgeVM();
const result = vm.run('2 + 2');
console.log(result); // 4

Sandboxed Environment

You can create a sandboxed environment with predefined global variables, ensuring that the executed code does not have access to the outer scope.

const { EdgeVM } = require('@edge-runtime/vm');
const vm = new EdgeVM({ sandbox: { foo: 'bar' } });
const result = vm.run('foo');
console.log(result); // 'bar'

Timeouts and Resource Limits

This feature allows you to set execution timeouts and resource limits to prevent infinite loops and excessive resource consumption.

const { EdgeVM } = require('@edge-runtime/vm');
const vm = new EdgeVM({ timeout: 1000 });
try {
  vm.run('while(true) {}');
} catch (e) {
  console.log(e.message); // 'Script execution timed out.'
}

Other packages similar to @edge-runtime/vm

Keywords

FAQs

Package last updated on 02 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc