A command line tool that generates DASL CIDs from input.
Automatically detects input format: JSON objects produce DAG-CBOR record CIDs, all other input produces RAW CIDs.
brew tap ngerakines/tap
brew install atpcid
$ atpcid --help
Compute a CID (Content Identifier) from input data.
By default, the tool auto-detects the CID type based on the input:
- Input starting with '{' is treated as a JSON record and produces a
DAG-CBOR record CID (CIDv1, codec 0x71, SHA-256).
- All other input produces a RAW CID (CIDv1, codec 0x55, SHA-256).
Use --raw or --record to override auto-detection.
INPUT MODES:
Positional arguments are processed as individual inputs, each producing
one CID. Use -- to read from stdin instead of positional arguments.
Use --files to read file contents from positional argument paths.
EXAMPLES:
# DAG-CBOR record CID from a JSON argument
atpcid '{"text":"hello"}'
# Multiple CIDs from multiple arguments
atpcid '{"text":"hello"}' '{"text":"world"}'
# DAG-CBOR record CID from stdin
echo '{"text":"hello"}' | atpcid --
# RAW CID from binary stdin
cat image.jpg | atpcid --
# Force RAW CID on JSON input
atpcid --raw '{"text":"hello"}'
# Force DAG-CBOR record CID from stdin
cat data.json | atpcid --record --
# RAW CIDs from files
atpcid --files --raw image1.jpg image2.jpg
# DAG-CBOR record CID from a JSON file
atpcid --files --record data.json
Usage: atpcid [OPTIONS] [INPUTS]...
Arguments:
[INPUTS]...
Input data strings, each producing one CID. When empty, reads
from stdin. With --files, each argument is treated as a file path
Options:
--raw
Force output as a RAW CID (codec 0x55)
--record
Force output as a DAG-CBOR record CID (codec 0x71)
--files
Treat positional arguments as file paths and read their contents
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version