In Node.js, capture the page with Playwright’s page.screenshot(), then pass the returned Buffer as the Body in an AWS SDK for JavaScript v3 PutObjectCommand. This sends the screenshot directly from memory to S3 without creating a temporary file. The example below captures the full scrollable page; omit fullPage: true for a viewport-only image.
What you need
This guide assumes a Node.js project using ES modules, Playwright, and AWS SDK for JavaScript v3. Install the packages:
As an Amazon Associate I earn from qualifying purchases.
npm install playwright @aws-sdk/client-s3
Playwright also needs its browser binary installed. Install Chromium for Playwright with:
Free tools Windows power users keep installed
One-click scans. No signup required.
npx playwright install chromium
Configure AWS credentials using the standard AWS SDK credential provider chain—for example, an assigned role in a deployed environment or credentials configured for local development. The identity must be allowed to upload objects to the target bucket. Set the bucket name in S3_BUCKET. Do not put long-lived credentials in source code.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
Capture a screenshot into memory and upload it
Save this as an ES module, such as screenshot-to-s3.mjs. The screenshot API returns a Buffer when no path is supplied; that buffer can be used as the S3 object body.
import { chromium } from 'playwright';
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
const targetUrl = process.argv[2] ?? 'https://example.com';
const bucket = process.env.S3_BUCKET;
if (!bucket) {
throw new Error('Set the S3_BUCKET environment variable.');
}
const browser = await chromium.launch();
try {
const page = await browser.newPage();
await page.goto(targetUrl, { waitUntil: 'load' });
// Captures the full scrollable page. Omit fullPage for the visible viewport only.
const screenshot = await page.screenshot({ fullPage: true });
const key = `screenshots/${Date.now()}.png`;
const s3 = new S3Client({});
await s3.send(new PutObjectCommand({
Bucket: bucket,
Key: key,
Body: screenshot,
ContentType: 'image/png',
}));
console.log(`Uploaded s3://${bucket}/${key}`);
} finally {
await browser.close();
}
Run it with a page URL and a bucket configured in the environment:
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
S3_BUCKET=my-screenshot-bucket node screenshot-to-s3.mjs https://example.com
The success message is printed only after the upload command resolves. A screenshot captured successfully is not, by itself, proof that S3 accepted or stored it: allow upload errors to surface and handle them in your application as needed. The code closes the browser in finally, including when navigation, capture, or upload fails.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Choose the capture and object behavior
Viewport or full page
page.screenshot() captures the current viewport by default. Set fullPage: true to capture the full scrollable document. Playwright documents additional screenshot options such as clipping, image quality, scale, and masking; consult its Page API reference for the behavior supported by your installed Playwright version.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Choose a key that matches your retention needs
The example uses a timestamp-based key so repeated runs create distinct names in ordinary circumstances. For a stable “latest” object, use a fixed key instead; a subsequent upload to the same bucket and key replaces the current object unless your bucket’s versioning and retention setup changes that behavior. For durable history, use a deliberate unique or versioned naming scheme. Choose the strategy before relying on screenshots for audits or downstream processing.
Keep access private unless public access is intentional
A successful PutObject upload does not make the object publicly readable. Keep the bucket and objects private by default, and grant the application identity only the permissions it needs. If a public or shared access path is required, design it through the appropriate bucket policy or controlled access mechanism for your account; do not add a public ACL as a casual default.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Save a local artifact as well
If you need a file for debugging, retention outside S3, or a separate upload step, give page.screenshot() a path. Then read the file bytes and use them as the request body, following the file-byte pattern in AWS’s JavaScript v3 example.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11import { readFile } from 'node:fs/promises';
import { chromium } from 'playwright';
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
const browser = await chromium.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'load' });
const path = 'screenshot.png';
await page.screenshot({ path, fullPage: true });
const s3 = new S3Client({});
await s3.send(new PutObjectCommand({
Bucket: process.env.S3_BUCKET,
Key: 'screenshots/example.png',
Body: await readFile(path),
ContentType: 'image/png',
}));
} finally {
await browser.close();
}
The in-memory version avoids disk I/O and a temporary artifact. The file version is useful when a local copy is part of the workflow, but it adds filesystem handling and cleanup decisions.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Handle large objects and operational failures
When a single PutObject is not the right path
Ordinary page screenshots generally fit a straightforward single-request workflow, but object size and service limits matter for unusually large captures. AWS’s PutObject examples note that uploads larger than 5 GB should use multipart upload (or the S3 console, for which the cited documentation states a 160 GB limit). For multipart workflows, AWS documents the JavaScript v3 @aws-sdk/lib-storage Upload approach in its multipart upload guide. Verify current service limits and SDK behavior against AWS documentation when implementing large-object handling.
Common errors and fixes
- Missing bucket: the sample stops early if
S3_BUCKETis unset. Define it in the process environment and check that its value is the intended bucket name. - Access denied or credential errors: confirm the AWS identity is available to the SDK and has permission to upload to the bucket and key prefix. Check the account, region, bucket policy, and any organization-level restrictions.
- Navigation timeout or failed page load: inspect the target URL and network accessibility from the machine running Chromium. If the site is slow or requires a later readiness signal, use an appropriate Playwright navigation or page-wait strategy rather than treating a failed navigation as a successful capture.
- Screenshot is blank or incomplete: confirm the page has rendered before capture. Some sites load important content after the initial load event; wait for a relevant selector or other site-specific readiness condition. Full-page capture includes the scrollable document, not content that the page has not loaded.
- Upload appears successful but cannot be viewed: S3 upload success does not grant read access. Check the object key and access policy through the access path your application is meant to use.
- Repeated jobs replace the same object: inspect the generated key. A fixed key intentionally targets the same object; use unique keys or an appropriate versioning policy if each run must be retained.
Or skip the browser setup
If you need a screenshot API instead of running Chromium and managing uploads, ScreenshotNeo accepts a URL in one GET request and returns an image or PDF. For example, this cURL request saves a WebP screenshot locally:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for request options and response details. ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can each be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, with response headers indicating the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Frequently Asked Questions
Does the in-memory Playwright screenshot need to be converted before uploading?
No. The screenshot buffer can be passed directly as the S3 Body.
Does uploading a screenshot make it publicly accessible?
No. Upload success does not determine read access; access depends on the bucket and object permissions you configure.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




