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

ivm-inspect

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ivm-inspect

[![npm version](https://badgen.now.sh/npm/v/ivm-inspect)](https://www.npmjs.com/package/ivm-inspect) [![mit license](https://badgen.now.sh/npm/license/ivm-inspect)](https://github.com/laverdet/ivm-inspect/blob/master/LICENSE) [![npm downloads](https://bad

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-71.87%
Maintainers
0
Weekly downloads
 
Created
Source

npm version mit license npm downloads

ivm-inspect -- Local console support within isolated-vm

NPM

This is library meant to be used in conjunction with isolated-vm. It adds rudimentary console support for the common case of outputting to a local console. I would guess it's probably pretty easy to crash the process by passing whacky objects to these functions so use this at your own risk.

API DOCUMENTATION

async create(isolate, context)
  • isolate - An isolate created within isolated-vm
  • context - A context
  • return { formatWithOptions, inspect }

This returns an object with two named Reference instances to the built-in nodejs functions util.formatWithOptions and util.inspect. These references belong to the isolate and maintain internal handles to the context. You can use these functions in any context created within this isolate-- you do not need to call this once per context.

async forwardConsole(context, util)
  • context - A context
  • util - The return value of await create(...)

This function configures a context's console to output directly to the process's stdout and stderr.

EXAMPLES

const ivm = require('isolated-vm');
const ivmInspect = require('ivm-inspect');

(async() => {
	const isolate = new ivm.Isolate;
	const context = await isolate.createContext();

	const util = await ivmInspect.create(isolate, context);
	await ivmInspect.forwardConsole(context, util);

	await context.eval('console.log("Here is an object: %O", { foo: "bar" })');
})().catch(console.error);

console output

Wow!

FAQs

Package last updated on 15 Aug 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