Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Screenshot format writes URL text to file instead of downloading image binary

Open Beginner friendly
#82 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
node.js, typescript
Domain
cli

Research direction

Start with handleScrapeCommand in src/commands/scrape.ts and handleScrapeOutput plus formatScreenshotOutput in src/utils/output.ts. Reproduce the single-URL command from the issue, then compare it with the binary-writing path in handleAllScrapeCommand. Done means an image output contains valid downloaded PNG or other image bytes rather than the screenshot URL text.

Written by the indexing model from the issue text.

Description

Bug

When using firecrawl scrape --format screenshot -o output.png, the CLI writes the screenshot URL as plain text to the output file instead of downloading the actual PNG image. This produces a corrupt file that appears to be a PNG but is actually a small text file containing the Firecrawl CDN URL.

Reproduction

firecrawl scrape "https://example.com" --format screenshot -o screenshot.png
file screenshot.png  # Reports: ASCII text, not PNG image data
cat screenshot.png   # Shows: "Screenshot: https://..."

Expected behavior

The CLI should fetch the image from the screenshot URL and write the binary data to the output file (like handleAllScrapeCommand already does correctly for multi-URL scrapes).

Root cause

In src/commands/scrape.ts, handleScrapeCommand delegates to handleScrapeOutput in src/utils/output.ts. For a single screenshot format, handleScrapeOutput calls formatScreenshotOutput() which returns the URL as text, then writeOutput() writes that text string to the file with utf-8 encoding.

The multi-URL code path (handleAllScrapeCommand in the same file, ~line 470) correctly handles this by fetching the URL and writing the binary buffer:

const response = await fetch(result.data.screenshot);
if (response.ok) {
    const buffer = Buffer.from(await response.arrayBuffer());
    fs.writeFileSync(filepath, buffer);
}

Suggested fix

In handleScrapeCommand, before calling handleScrapeOutput, check if the output is a single screenshot format going to an image file extension. If so, fetch the binary and write it directly:

const isScreenshotOnly = effectiveFormats.length === 1 && effectiveFormats[0] === 'screenshot';
const isImageOutput = options.output && /\.(png|jpg|jpeg|webp)$/i.test(options.output);
if (isScreenshotOnly && isImageOutput && result.success && result.data?.screenshot) {
    const response = await fetch(result.data.screenshot);
    const buffer = Buffer.from(await response.arrayBuffer());
    fs.writeFileSync(options.output, buffer);
    return;
}

Environment

  • firecrawl-cli 1.10.0
  • Windows 11 / Node.js
Dominant language
TypeScript
Stars
635
Forks
106
Avg merge
4h 52m
Merged PRs (30d)
43

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firecrawl/cli

All issues in firecrawl/cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.