Assets
Commands for managing assets in the Knock CLI.
Asset commands enable you to upload and archive assets in your Knock account from the CLI. Knock hosts the image you upload and returns a URL that you can use in your notification templates.
Assets are account-wide. Asset commands do not take an environment or branch.
knock asset upload <file> [flags]
#Upload a file to your account as an asset. The command prints the asset's id, hosted URL, MIME type, and creation time.
Pass a file path, or pass - to read the file from stdin. When you read from stdin, the --filename flag is required.
Knock supports JPEG, PNG, and GIF images, and each file must be between 1 byte and 5,000,000 bytes. The command detects the MIME type from the file extension and the file's contents. If the two disagree, or the type cannot be detected, pass the --mime-type flag to choose one.
Flags
The display name for the asset. Defaults to the file's name. Required when reading from stdin.
Overrides the detected MIME type. One of: image/jpeg, image/png, image/gif.
Format output as json.
knock asset archive <asset_id> [flags]
#Archive an asset. The asset id must be a UUID, which the knock asset upload command prints when it finishes.
Pass --force when you also pass --json.
Flags
Removes the confirmation prompt. Required when using --json. Defaults to false.
Format output as json.