# CLI reference: the Any Doc CLI (pinned @firecrawl/anydoc@0.2.4) Everything here was captured by running the pinned CLI on this machine (`npx -y @firecrawl/anydoc@0.2.4`, version 0.2.4, Node v22). The CLI is a 4.7 KB Node wrapper (`bin.anydoc = cli.js`) around a native NAPI binding that ships as an npm `optionalDependency` per platform. ## Verbatim `--help` output ``` anydoc: convert documents to GitHub-Flavored Markdown Usage: anydoc [options] anydoc - [options] < file Converts one document per invocation and writes the Markdown to stdout. Pass - as the input to read the document from stdin. Never prompts; all diagnostics go to stderr. Options: -o, --output Write the Markdown to instead of stdout -f, --format Name the input format instead of detecting it: doc, docx, odt, pdf, ppt, pptx, rtf, epub, xlsx, ods, odp, csv (extension aliases like xls, docm, ppsx resolve to these) --ocr `reject` (default) or `hosted` for OCR-required PDFs --allow-hosted-upload Acknowledges whole-document upload for hosted OCR -h, --help Print this help and exit -V, --version Print the version and exit The format is detected from the file content; the file extension is the fallback for signature-less formats (CSV). stdin has no extension, so CSV input from stdin needs --format csv. Scanned or image-only PDFs need OCR, which anydoc does not do, and error as unsupported. Exit codes: 0 success 1 the document could not be read or converted 2 usage error: unknown option, missing input, or invalid --format Examples: anydoc report.docx anydoc slides.pptx -o slides.md anydoc - --format csv < data.csv curl -s https://example.com/paper.pdf | anydoc - ``` `anydoc --version` prints exactly `0.2.4` (verified; both `--help` and `--version` exit 0 and write to stdout). ## Invocation forms ```text anydoc [options] # convert a path on disk anydoc - [options] < file # read the document from stdin ``` - `-` as the input reads the document from **stdin**. - The CLI accepts **exactly one document per invocation** — there is no batch mode. Passing a second input exits 2: `anydoc: one document per invocation: unexpected second input ''`. For multiple documents use a shell loop or `scripts/anydoc batch` (see [workflows.md](workflows.md)). ## Flag reference | Token | Behavior (verified) | | --- | --- | | `` | Input path. Format detected from content; extension is the fallback for signature-less formats (CSV). | | `-` | Read the document from stdin. If stdin is a TTY, exits 2 with `anydoc: stdin is a terminal; pipe or redirect a document into anydoc -`. | | `-o `, `--output ` | Write the Markdown to `` instead of stdout. **Silently overwrites** an existing file (verified). Writing to a directory fails with exit 1: `anydoc: EISDIR: illegal operation on a directory, open ''`. With `-o`, stdout stays silent. | | `-f `, `--format ` | Force the input format instead of detecting it. Values: `doc, docx, odt, pdf, ppt, pptx, rtf, epub, xlsx, ods, odp, csv`. Extension aliases resolve through the parser mapping (verified: `--format xls`, `--format docm` accepted). Invalid value → exit 2: `anydoc: invalid format 'bogus'; expected one of: doc, docx, odt, pdf, ppt, pptx, rtf, epub, xlsx, ods, odp, csv`. | | `-h`, `--help` | Print help to stdout, exit 0. Works even when the native binding is unavailable. | | `-V`, `--version` | Print the version (`0.2.4`) to stdout, exit 0. Binding-independent like `--help`. | | `--format=x` | Inline `=` value syntax is supported for long options (verified: `--format=rtf` works). | | `--` | End of options: everything after `--` is treated as a positional input (a filename starting with `-`). | | Missing option value | `anydoc: