B4n1Web JavaScript/TypeScript SDK

Ultra-lightweight agentic browser engine with bundled binary.
Install
npm install b4n1-web
Binary is bundled — no separate installation needed.
Quick Start
import { AgentBrowser, BrowserMode } from 'b4n1-web';
const browser = new AgentBrowser({ mode: BrowserMode.LIGHT });
const page = await browser.goto('https://example.com');
console.log(page.markdown);
console.log(`${page.links.length} links found`);
browser.close();
Page API
page.url
page.markdown
page.links
page.screenshot
page.getMainContent()
page.findLinksByText("more")
Browser Modes
BrowserMode.LIGHT | HTTP + HTML parsing |
BrowserMode.JS | Light + script extraction |
BrowserMode.RENDER | Full Chromium + screenshots |
Security
import { SecurityShield } from 'b4n1-web';
const shield = new SecurityShield();
shield.markDomain('evil.com', false);
const { isSafe, needsApiCheck } = shield.isUrlSafe('https://evil.com');
Error Handling
import { BinaryNotFoundError } from 'b4n1-web';
try {
const browser = new AgentBrowser();
} catch (e) {
if (e instanceof BinaryNotFoundError) {
console.error('Install binary: curl -sL https://b4n1.com/install | bash');
}
}
Context Manager
import { AgentBrowser } from 'b4n1-web';
async function main() {
const browser = new AgentBrowser();
try {
const page = await browser.goto('https://example.com');
console.log(page.markdown);
} finally {
browser.close();
}
}
const browser = new AgentBrowser();
try {
await browser.goto('https://example.com');
} finally {
await browser[Symbol.asyncDispose]();
}
Version
SDK: 0.9.8 | Binary: 0.9.6 (bundled)
Links
Built by B4N1 with ❤️ · All rights reserved.