[Go to site: main page, start]

Skip to content

Browser Functions

Write a function. Get a value. microlink.run() runs your JavaScript in a sandbox — the browser is optional and boots only when your code touches the page.

Overview

Browser optional. Value guaranteed.

microlink.run(url, code) ships a plain function to a remote sandbox — serialization, compression, and the API call are handled for you. Reference page for the full Puppeteer page; skip it and no browser starts at all. See the function parameter.
  • No page reference → no browser — faster, cheaper compute
  • require() any npm package — installed on the fly and cached
  • result.isFulfilled stays true even when your code throws
  • profiling.phases breaks down install / build / spawn / run
Parameters

What run() forwards.

Examples
Plain compute — Chrome never boots, so it stays fast.
No page, no browser
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const { value } = await microlink.run(
  'https://example.com',
  () => 40 + 2
)
// → 42