diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ak-calculate-size | 14 | ||||
-rwxr-xr-x | bin/ak-cli | 4 | ||||
-rwxr-xr-x | bin/ak-extract-cids | 8 | ||||
-rwxr-xr-x | bin/ak-zchain-calculate-size | 29 | ||||
-rwxr-xr-x | bin/ak-zchain-extract-cids | 13 |
5 files changed, 44 insertions, 24 deletions
diff --git a/bin/ak-calculate-size b/bin/ak-calculate-size deleted file mode 100755 index 63ae2f7..0000000 --- a/bin/ak-calculate-size +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -ak-extract-cids > to_stats -sum=0 ; while IFS="" read -r p || [ -n "$p" ] -do - if [ "$p" != "" ] - then - num=$(ak-ipfs-block-stat $p | grep Size | sed -e 's/Size: //g') - else - num=0 - fi - sum=$(expr $sum + $num ) -done < to_stats -echo "Chain is : $sum bytes" -rm to_stats @@ -333,7 +333,7 @@ help_network(){ help_utils(){ printf ' - ak-calculate-size + ak-zchain-calculate-size ' printf ' ak-data-expand @@ -357,7 +357,7 @@ help_uncatecorized(){ ak-get-chain-minified ' printf ' - ak-extract-cids + ak-zchain-extract-cids ' printf ' ak-get-ipfs-hashes-from-my-zchain diff --git a/bin/ak-extract-cids b/bin/ak-extract-cids deleted file mode 100755 index 3076ace..0000000 --- a/bin/ak-extract-cids +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# -# Extracts unique IPFS CIDs from an ak-entered zchain -# -# Previously: -# ak-enter | jq | grep Qm | sed -e 's/^.*Qm/Qm/g' | cut -d '"' -f 1 -# -ak-enter | jq | grep Qm | sed -e 's/".*"://g; s/ //g; s/[{,"]//g' | sort | uniq diff --git a/bin/ak-zchain-calculate-size b/bin/ak-zchain-calculate-size new file mode 100755 index 0000000..ca41e53 --- /dev/null +++ b/bin/ak-zchain-calculate-size @@ -0,0 +1,29 @@ +#!/bin/bash +PROGRAM="$(basename $0)" + +temp="$(mktemp -d)" + +cd $temp + +if [ ! -z $1 ] && [ -n "$1" ] +then + ak-extract-cids $1 > to_stats +else + ak-extract-cids > to_stats +fi + +sum=0 ; while IFS="" read -r p || [ -n "$p" ] +do + if [ "$p" != "" ] + then + ak-ipfs-get $p + num="$(du -bs --apparent-size $p | cut -d $'\t' -f 1)" + else + num=0 + fi + sum=$(expr $sum + $num ) +done < to_stats +echo "Chain is : $sum bytes" + +cd ~ +rm -rf $temp diff --git a/bin/ak-zchain-extract-cids b/bin/ak-zchain-extract-cids new file mode 100755 index 0000000..a07c481 --- /dev/null +++ b/bin/ak-zchain-extract-cids @@ -0,0 +1,13 @@ +#!/bin/bash +# +# Extracts unique IPFS CIDs from an ak-entered zchain +# +# Previously: +# ak-enter | jq | grep Qm | sed -e 's/^.*Qm/Qm/g' | cut -d '"' -f 1 +# +if [ ! -z $1 ] && [ -n "$1" ] +then + ak-enter $1 | jq | grep Qm | sed -e 's/".*"://g; s/ //g; s/[{,"]//g' | sort | uniq +else + ak-enter | jq | grep Qm | sed -e 's/".*"://g; s/ //g; s/[{,"]//g' | sort | uniq +fi |