crw-parse

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

crw-parse — local file extraction

crw-parse — 本地文件提取

When to use

使用场景

  • The source is a file on disk (PDF), not a web page.
  • Step 5 in the crw ladder. If you have a URL, use crw-scrape (step 2) instead — scrape handles remote PDFs via URL. If you want a typed JSON object from a page, see crw-extract (step 6).
  • PDF only. DOCX, XLSX, and other office formats are not yet supported (unlike Firecrawl's document endpoint). If you have a non-PDF document, convert it to PDF first or use an external tool.
  • 源文件是磁盘上的文件(PDF),而非网页。
  • 属于crw工作流阶梯的第5步。如果是URL链接,请改用crw-scrape(第2步)——scrape可通过URL处理远程PDF。如果想要从页面生成带类型的JSON对象,请查看crw-extract(第6步)。
  • 仅支持PDF格式。暂不支持DOCX、XLSX及其他办公格式(与Firecrawl的文档端点不同)。如果是非PDF文档,请先将其转换为PDF或使用外部工具。

Quick start

快速开始

CLI
crw scrape
auto-detects a local file path and routes to the PDF parser; there is no separate
crw parse
subcommand:
bash
crw scrape report.pdf                         # → markdown to stdout
crw scrape report.pdf --format json --extract '{"type":"object","properties":{"title":{"type":"string"}}}' -o out.json
MCP (inside an agent harness):
crw_parse_file(
  contentBase64="<base64-encoded PDF bytes>",
  filename="report.pdf",
  formats=["markdown"],
  maxLength=0
  # For structured JSON output:
  # formats=["json"],
  # jsonSchema={"type":"object","properties":{"title":{"type":"string"}}}
)
REST — multipart upload, 50 MB limit, PDF only:
bash
curl -X POST "$CRW_API_URL/v2/parse" \
  -H "Authorization: Bearer $CRW_API_KEY" \
  -F "file=@report.pdf" \
  -F 'options={"formats":["markdown"]}'
CLI
crw scrape
会自动检测本地文件路径并路由到PDF解析器;没有单独的
crw parse
子命令:
bash
crw scrape report.pdf                         # → markdown to stdout
crw scrape report.pdf --format json --extract '{"type":"object","properties":{"title":{"type":"string"}}}' -o out.json
MCP(在Agent框架内):
crw_parse_file(
  contentBase64="<base64-encoded PDF bytes>",
  filename="report.pdf",
  formats=["markdown"],
  maxLength=0
  # For structured JSON output:
  # formats=["json"],
  # jsonSchema={"type":"object","properties":{"title":{"type":"string"}}}
)
REST — 多部分上传,限制50 MB,仅支持PDF:
bash
curl -X POST "$CRW_API_URL/v2/parse" \
  -H "Authorization: Bearer $CRW_API_KEY" \
  -F "file=@report.pdf" \
  -F 'options={"formats":["markdown"]}'

Options

配置选项

NeedCLI (
crw scrape <path>
)
MCP fieldREST
options
field
Output format
--format markdown|json|text|links
formats
formats
Structured JSON
--extract '<schema>'
jsonSchema
+
formats:["json"]
jsonSchema
+
formats:["json"]
AI summary
--summary
formats:["summary"]
formats:["summary"]
Summary prompt
--prompt "TEXT"
summaryPrompt
Limit output chars
maxLength
(0 = unbounded)
maxContentChars
Force parser
parsers:["pdf"]
parsers:["pdf"]
Formats
json
and
summary
require a server-side LLM configured in
[extraction.llm]
of the server config (or via
crw setup
for the CLI).
需求CLI(
crw scrape <path>
MCP字段REST
options
字段
输出格式
--format markdown|json|text|links
formats
formats
结构化JSON
--extract '<schema>'
jsonSchema
+
formats:["json"]
jsonSchema
+
formats:["json"]
AI摘要
--summary
formats:["summary"]
formats:["summary"]
摘要提示词
--prompt "TEXT"
summaryPrompt
限制输出字符数
maxLength
(0表示无限制)
maxContentChars
强制指定解析器
parsers:["pdf"]
parsers:["pdf"]
格式为
json
summary
时,需要在服务器配置的
[extraction.llm]
部分(或通过CLI的
crw setup
)配置服务端LLM。

Honest gaps

已知局限

  • PDF only. The server rejects anything without a
    %PDF-
    magic header.
  • No OCR. Scanned/image-only PDFs have no extractable text layer; they return empty markdown with a warning. There is no
    attempt_scanned
    option — scanned PDFs are a known gap.
  • 50 MB cap on REST uploads (per-route hard limit). The CLI passes bytes in-process, so it shares the same underlying limit.
  • LLM required for
    json
    /
    summary
    .
    Without a configured LLM the request returns a 400.
  • 仅支持PDF。服务器会拒绝任何不带有
    %PDF-
    魔术头的文件。
  • 无OCR功能。扫描版/仅含图片的PDF没有可提取的文本层,返回空的Markdown并给出警告。目前没有
    attempt_scanned
    选项——扫描版PDF是已知的功能缺口。
  • REST上传限制50 MB(单路由硬限制)。CLI在进程内传递字节,因此也受相同的底层限制。
  • 生成
    json
    /
    summary
    需要LLM
    。未配置LLM时,请求会返回400错误。

Tips

使用技巧

  • Read the result, don't stream it. For large PDFs, write to
    .crw/
    and
    grep
    /
    head
    the output:
    crw scrape big.pdf -o .crw/big.md
    .
  • MCP requires base64. Read the file in your agent, base64-encode the bytes, pass as
    contentBase64
    . The
    filename
    field is optional but helps with error messages.
  • Scanned PDFs return empty markdown — no warning field. If the PDF has no extractable text layer, the REST response returns empty markdown with no
    warning
    field in the envelope. A warning (e.g.
    warning: pdf_partial_text
    ) only appears on the CLI's stderr, never in the REST/MCP response. If you get empty markdown, assume a scanned/image-only PDF and handle it at call-site.
  • 读取结果而非流式处理。对于大型PDF,将结果写入
    .crw/
    目录后,使用
    grep
    /
    head
    查看输出:
    crw scrape big.pdf -o .crw/big.md
  • MCP要求Base64编码。在Agent中读取文件,对字节进行Base64编码,作为
    contentBase64
    传入。
    filename
    字段可选,但有助于生成错误信息。
  • 扫描版PDF返回空Markdown——无警告字段。如果PDF没有可提取的文本层,REST响应会返回空的Markdown,且响应包中没有
    warning
    字段。警告信息(例如
    warning: pdf_partial_text
    )仅会出现在CLI的stderr中,绝不会出现在REST/MCP响应里。如果得到空的Markdown,请默认是扫描版/仅含图片的PDF,并在调用端处理该情况。

See also

相关链接

  • crw-scrape — fetch a URL (including a remote PDF served over HTTP)
  • crw-extract — typed JSON object from a page against a schema
  • crw — ladder overview and routing rules
  • crw-scrape — 获取URL内容(包括通过HTTP提供的远程PDF)
  • crw-extract — 根据Schema从页面生成带类型的JSON对象
  • crw — 工作流阶梯概述及路由规则