zshot/cliDownload

Local Inputs

Besides http(s) URLs, zshot renders content you provide directly:

  • data: URIsdata:text/html;base64,… or percent-encoded, up to 10MB. Also accepted by the HTTP API’s url parameter.
  • File paths — a path to a local file.
  • Stdin — pass - as the URL and pipe content in.

Input MIME type

The browser picks a local file’s type from its extension. Known extensions keep their registry type, and unknown extensions — component files like .astro, or files with no extension — are treated as text/html, so an HTML snippet renders as markup rather than a source listing. --input-mimetype declares the type explicitly for file and stdin input when the extension is misleading:

zshot card.astro -f card.md                        # unknown extension: rendered as HTML
zshot notes.html --input-mimetype text/plain -f notes.png   # shown as source text

A data: URI’s declared type routes the same way: data:image/png;base64,… renders as an image, and an unrecognized or absent type renders as HTML.

Snippet normalization

Local HTML content without a doctype is prepended with <!DOCTYPE html><meta charset="utf-8"> before rendering, so a bare snippet like <div>hi</div> renders in standards mode with UTF-8 text. Content that carries any doctype loads byte-for-byte as given, as does all network content.

Details:

  • The meta charset is skipped when the content declares its own charset, or when a non-UTF-8 charset is declared via a data: URI ;charset= or --input-mimetype.
  • A file rendered away from its original path gets a <base href> pointing at the file’s directory, so relative images and stylesheets keep resolving.
  • Non-UTF-8 local content is left untouched.