![](https://github.com/binary-blazer/shb/raw/master/assets/logo_rounded.png)
Screenshot Browser (shbrw) is a frameless CLI browser designed for taking screenshots of websites. It provides both a CLI and an API for capturing screenshots.
To install the package, use npm:
npm install -g shbrw
# or
yarn global add shbrw
# or
pnpm add -g shbrw
# or
bun install -g shbrw
To open a headless and frameless browser window, use the following command:
shbrw --url=<websiteUrl> [--size=WxH] [--optimized] [--noJS]
Then, right-click on the page and select "Take Screenshot" from the context menu.
--url
: The URL of the website to open.--size
: The size of the window in the formatWxH
(default:1280x720
).--optimized
: Run the website in optimized mode.--noJS
: Disable JavaScript on the website.
You can also use the API to take screenshots programmatically.
import { takeScreenshot } from 'shbrw';
const url = 'https://example.com';
const options = {
width: 1920,
height: 1080,
x: 0,
y: 0,
noJS: false
};
takeScreenshot(url, options)
.then(buffer => {
// Do something with the screenshot buffer
})
.catch(error => {
console.error('Error taking screenshot:', error);
});
url
: The URL of the website to take a screenshot of.options
: An object containing the following properties:width
: The width of the screenshot (default:1280
).height
: The height of the screenshot (default:720
).x
: The x-coordinate of the screenshot (default:0
).y
: The y-coordinate of the screenshot (default:0
).noJS
: Disable JavaScript on the website (default:false
).