Package Exports
- @lightpanda/browser
- @lightpanda/browser/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lightpanda/browser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
About The Project
Lightpanda is the open-source browser made for headless usage:
- Javascript execution
- Support of Web APIs (partial, WIP)
- Compatible with Playwright, Puppeteer through CDP (WIP)
Fast web automation for AI agents, LLM training, scraping and testing:
- Ultra-low memory footprint (9x less than Chrome)
- Exceptionally fast execution (11x faster than Chrome)
- Instant startup
Puppeteer requesting 100 pages from a local website on a AWS EC2 m5.large instance. See benchmark details.
Getting Started
Configuration
Environment variables
LIGHTPANDA_EXECUTABLE_PATHcan be specified if you want to use your own version and avoid the binary from being installed on postinstall. The default folder is~/.cache/lightpanda-node
Install
When installing the package, the binary corresponding to your platform will be automatically downloaded. If your OS is not supported, download will fail
yarn add @lightpanda/browseror
npm install @lightpanda/browseror
pnpm add @lightpanda/browserUpgrade browser
At some point in time, you might want to upgrade Lightpanda browser to a more recent version. To do so, you can run the following command:
npx @lightpanda/browser upgradeExamples
Fetch a page
With Lightpanda you can easily get a page's data by calling the fetch() function.
import { type LightpandaFetchOptions, lightpanda } from '@lightpanda/browser'
const options: LightpandaFetchOptions = {
dump: true,
disableHostVerification: false,
httpProxy: 'https://proxy.lightpanda.io',
}
const res = await lightpanda.fetch('https://lightpanda.io', options)
// Do your magic ✨Start a CDP Server
The websocket will allow you to control the browser and do a series of actions on webpages.
import { type LightpandaServeOptions, lightpanda } from '@lightpanda/browser'
const options: LightpandaServeOptions = {
host: '127.0.0.1',
port: 9222,
}
const proc = await lightpanda.serve(options)
// Do your magic ✨
proc.stdout.destroy()
proc.stderr.destroy()
proc.kill()ℹ️ Lightpanda's CDP server can be used alongside projects like Puppeteer or Playwright.
