API

mql(<url>, [options])

url

required
Type: <string>
The target URL for getting content.

options

Type: <object>
You can pass any API Parameters from Microlink API as an option.
const mql = require('@microlink/mql')

const { status, data, response } = await mql('https://kikobeats.com', {
  screenshot: true,
  device: 'iPad',
  palette: true,
})

console.log(`My screenshot at ${data.screenshot.url}`)

Additionally, you can configure:
apiKey
Type: <string>
The API Key used for authenticating your requests as x-api-key header.
When the apiKey is provided, the as endpoint will be used.
cache
Type: <object>
Note: this feature is only available for Node.js.
When you pass an object that follows Map API, you can enable serve response from your storage cache in order to save API if they have been previously done.
const mql = require('@microlink/mql')
const cache = new Map()

let data

data = await mql('https://example.com', { cache })
console.log(data.response.fromCache)
// => false

data = await mql('https://example.com', { cache })
console.log(data.response.fromCache)
// => true
Caching feature is only available in the Node.js bundle.
Consider to pass for supporting
See to know more.
retry
Type: <number>
Default: 2
Defines how many retries can be done before an API call is considered failed.
See to know more.

mql.stream(<url>, [options])

Returns a instead of a Promise.

mql.buffer(<url>, [options])

Returns a instead of a Promise.

API

mql(<url>, [options])

url

required
Type: <string>
The target URL for getting content.

options

Type: <object>
You can pass any API Parameters from Microlink API as an option.
const mql = require('@microlink/mql')

const { status, data, response } = await mql('https://kikobeats.com', {
  screenshot: true,
  device: 'iPad',
  palette: true,
})

console.log(`My screenshot at ${data.screenshot.url}`)

Additionally, you can configure:
apiKey
Type: <string>
The API Key used for authenticating your requests as x-api-key header.
When the apiKey is provided, the as endpoint will be used.
cache
Type: <object>
Note: this feature is only available for Node.js.
When you pass an object that follows Map API, you can enable serve response from your storage cache in order to save API if they have been previously done.
const mql = require('@microlink/mql')
const cache = new Map()

let data

data = await mql('https://example.com', { cache })
console.log(data.response.fromCache)
// => false

data = await mql('https://example.com', { cache })
console.log(data.response.fromCache)
// => true
Caching feature is only available in the Node.js bundle.
Consider to pass for supporting
See to know more.
retry
Type: <number>
Default: 2
Defines how many retries can be done before an API call is considered failed.
See to know more.

mql.stream(<url>, [options])

Returns a instead of a Promise.

mql.buffer(<url>, [options])

Returns a instead of a Promise.