Type to search…

Astral

Introducció

Astral

shell
deno init astral
cd astral
deno add add jsr:@astral/astral
ts
screenshot.ts
// Import Astral
import { launch } from "@astral/astral"

// Launch the browser
    await using browser = await launch();

// Open a new page
    await using page = await browser.newPage("https://deno.land");

// Take a screenshot of the page and save that to disk
const screenshot = await page.screenshot();
Deno.writeFileSync("screenshot.png", screenshot);

// Clean up is performed automatically
shell
deno run --allow-all .\screenshot.ts