crw-parse
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecrw-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 — auto-detects a local file path and routes to the PDF
parser; there is no separate subcommand:
crw scrapecrw parsebash
crw scrape report.pdf # → markdown to stdout
crw scrape report.pdf --format json --extract '{"type":"object","properties":{"title":{"type":"string"}}}' -o out.jsonMCP (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 — 会自动检测本地文件路径并路由到PDF解析器;没有单独的子命令:
crw scrapecrw parsebash
crw scrape report.pdf # → markdown to stdout
crw scrape report.pdf --format json --extract '{"type":"object","properties":{"title":{"type":"string"}}}' -o out.jsonMCP(在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
配置选项
| Need | CLI ( | MCP field | REST |
|---|---|---|---|
| Output format | | | |
| Structured JSON | | | |
| AI summary | | | |
| Summary prompt | | — | |
| Limit output chars | — | | |
| Force parser | — | | |
Formats and require a server-side LLM configured in
of the server config (or via for the CLI).
jsonsummary[extraction.llm]crw setup| 需求 | CLI( | MCP字段 | REST |
|---|---|---|---|
| 输出格式 | | | |
| 结构化JSON | | | |
| AI摘要 | | | |
| 摘要提示词 | | — | |
| 限制输出字符数 | — | | |
| 强制指定解析器 | — | | |
格式为和时,需要在服务器配置的部分(或通过CLI的)配置服务端LLM。
jsonsummary[extraction.llm]crw setupHonest gaps
已知局限
- PDF only. The server rejects anything without a magic header.
%PDF- - No OCR. Scanned/image-only PDFs have no extractable text layer; they
return empty markdown with a warning. There is no option — scanned PDFs are a known gap.
attempt_scanned - 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. Without a configured LLM the request returns a 400.summary
- 仅支持PDF。服务器会拒绝任何不带有魔术头的文件。
%PDF- - 无OCR功能。扫描版/仅含图片的PDF没有可提取的文本层,返回空的Markdown并给出警告。目前没有选项——扫描版PDF是已知的功能缺口。
attempt_scanned - REST上传限制50 MB(单路由硬限制)。CLI在进程内传递字节,因此也受相同的底层限制。
- 生成/
json需要LLM。未配置LLM时,请求会返回400错误。summary
Tips
使用技巧
- Read the result, don't stream it. For large PDFs, write to and
.crw//grepthe output:head.crw scrape big.pdf -o .crw/big.md - MCP requires base64. Read the file in your agent, base64-encode the bytes,
pass as . The
contentBase64field is optional but helps with error messages.filename - Scanned PDFs return empty markdown — no warning field. If the PDF has no
extractable text layer, the REST response returns empty markdown with no
field in the envelope. A warning (e.g.
warning) 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.warning: pdf_partial_text
- 读取结果而非流式处理。对于大型PDF,将结果写入目录后,使用
.crw//grep查看输出:head。crw scrape big.pdf -o .crw/big.md - MCP要求Base64编码。在Agent中读取文件,对字节进行Base64编码,作为传入。
contentBase64字段可选,但有助于生成错误信息。filename - 扫描版PDF返回空Markdown——无警告字段。如果PDF没有可提取的文本层,REST响应会返回空的Markdown,且响应包中没有字段。警告信息(例如
warning)仅会出现在CLI的stderr中,绝不会出现在REST/MCP响应里。如果得到空的Markdown,请默认是扫描版/仅含图片的PDF,并在调用端处理该情况。warning: pdf_partial_text
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 — 工作流阶梯概述及路由规则