Skip to main content

Upload

The upload command group uploads content to Irys (permanent Arweave-backed storage) and returns a CID. Use this when you want to store large payloads off-chain and include only the CID pointer in your Packet messages.

The upload uses free-tier Irys (under the size limit) by default.


upload raw

Upload a raw string payload and get back a CID.

packet upload raw --content <text> [--content-type <mime>]
FlagDefaultDescription
--content <text>requiredContent string to upload
--content-type <mime>application/jsonMIME type of the content

Example:

packet upload raw --content '{"hello":"world"}' --content-type application/json

Output:

Uploaded: { url: "https://gateway.irys.xyz/<cid>", id: "<cid>" }

upload file

Upload a file from disk and get back a CID.

packet upload file <path> [--content-type <mime>]
Argument/FlagDescription
<path>Path to the file to upload
--content-type <mime>Override MIME type (auto-detected from file extension or file-type if omitted)

MIME auto-detection:

The CLI detects the content type in this order:

  1. --content-type flag (if provided)
  2. Magic bytes via file-type
  3. File extension (.json, .txt, .html, .md, .yaml, .svg, etc.)
  4. Falls back to application/octet-stream

Examples:

# Upload a PDF (auto-detected as application/pdf)
packet upload file ./report.pdf

# Upload a JSON file
packet upload file ./data.json

# Override content type
packet upload file ./blob.bin --content-type application/octet-stream

Using Uploads in Messages

The message new-thread and message new commands have a built-in --upload flag that combines uploading and sending in one step:

# Upload a file and send the Irys CID as the message content
packet message new-thread --to <pubkey> --file ./doc.txt --upload

# Encrypted upload
packet message new-thread --to <pubkey> --file ./doc.txt --upload --encrypt

The upload commands are useful when you want to pre-upload content and send the CID separately, or when you want to share the same CID across multiple messages.