Skip to main content

Module attachment

Module attachment 

Source
Expand description

附件:随页面一起导出的文件(PDF 内嵌图片、Office 媒体、网页图片)。

对外的 JSON 只有 {id, format, bytes, hash}(加上来源 source);文件内容不进 JSON, HTTP API 用单独的接口下载(GET /v2/attachments/{id})。在 pagesift 内部(缓存、多服务器的 任务结果)用非人类可读的二进制编码时连同内容一起编码,结果交给网关时附件不丢。

Structs§

Attachment
一个附件。id 是内容寻址的文件名:SHA-256 的前 32 位十六进制加扩展名(与 PDF、Office 的 导出文件名同一规则),同一内容只有一个 id。

Functions§

mime_of
扩展名 → MIME 类型(IANA 媒体类型注册表)。
sniff_image_format
Identify an image from its bytes rather than a filename or HTTP header. SVG has no binary magic; this recognizes an SVG root but is not a sanitizer.