The document's bytes.
The Content-Type the server sent, verbatim (e.g. application/pdf,
text/markdown; charset=utf-8). application/octet-stream when none was sent. The
type is the source's choice, so never render the document inline on your own origin
on the strength of it.
A purchase's licence document, as
purchases.licenseDocument(id)returns it.The body is raw bytes rather than decoded JSON, because the document is whatever the work's source served: usually a PDF, Markdown for an SEC filing, or anything else.
ArrayBufferis used because it works the same in Node, browsers and edge runtimes: wrap it withBuffer.from(body)in Node,new Blob([body], { type: contentType })in a browser, ornew TextDecoder().decode(body)for atext/*type.