Skip to content

Commit

Permalink
add script for metadata-calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
anjor committed Jul 15, 2024
1 parent 1f8eb59 commit f700cd5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tools/metadata-calculation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -o pipefail
set -e

filename=$1

response=$(cat $filename | stream-commp 2>&1)

# Example response:
# cat epoch-0-1.car| stream-commp

# CommPCid: baga6ea4seaqlenpkttfecrwa74hkwfp3pnmkaatmiiwpvuclwtxcl4uvkajemea
# Payload: 1004138576 bytes
# Unpadded piece: 1065353216 bytes
# Padded piece: 1073741824 bytes

# CARv1 detected in stream

commp=$(echo $response | grep -o "CommPCid.*" | cut -f 2 -d ":" | xargs)
paddedSize=$(echo $response | grep -o "Padded piece:.*" | cut -f 2 -d ":" | sed "s/bytes//" | xargs)

echo $filename, $commp, $paddedSize

0 comments on commit f700cd5

Please sign in to comment.