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.

Irys uploads under 100 KiB are free on the current upload path. Larger uploads require funding the Irys account. The CLI uses the configured wallet and attempts the required Irys funding/payment automatically when the upload needs it, so keep enough SOL in that wallet. Use Irys' current price tooling for exact pricing; about 2.50 USD / GB is only a rough planning estimate.

Irys is the recommended default because it gives sent message bodies durable storage. You can use IPFS, Arweave, HTTPS, or custom storage instead, but receivers must be able to fetch the link later. If that server, gateway, resource, or pin disappears, the on-chain message can remain while the body becomes unreadable.


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 / FlagDefaultDescription
<path>requiredPath to the file to upload
--content-type <mime>detectedOverride 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.