mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
upload tool good for directories and files as well. Should work on OS X, too.
This commit is contained in:
parent
b596f34056
commit
b53b5d2522
1 changed files with 14 additions and 4 deletions
|
|
@ -2,11 +2,21 @@
|
|||
|
||||
INDEX='index.html'
|
||||
|
||||
delimiter='{"entries":[{'
|
||||
|
||||
if [ -f "$1" ]; then
|
||||
hash=`wget -q -O- --post-file="$1" http://localhost:8500/raw`
|
||||
mime=`file --mime-type -b "$1"`
|
||||
wget -q -O- --post-data="$delimiter\"hash\":\"$hash\",\"contentType\":\"$mime\"}]}" http://localhost:8500/raw
|
||||
echo
|
||||
|
||||
else
|
||||
|
||||
[ -d "$1" ] || exit -1
|
||||
|
||||
bzzroot="$1"
|
||||
[ "_$1" = _ ] && bzzroot=.
|
||||
|
||||
delimiter='{"entries":[{'
|
||||
|
||||
pushd "$bzzroot" > /dev/null
|
||||
|
||||
(for path in `find . -type f`
|
||||
|
|
@ -15,14 +25,14 @@ name=`echo "$path" | cut -c2-`
|
|||
[ _`basename "$name"` = "_$INDEX" ] && name=`dirname "$name"`
|
||||
echo -n "$delimiter"
|
||||
hash=`wget -q -O- --post-file="$path" http://localhost:8500/raw`
|
||||
mime=`mimetype -b "$path"`
|
||||
mime=`file --mime-type -b "$path"`
|
||||
echo -n "\"hash\":\"$hash\",\"path\":\"$name\",\"contentType\":\"$mime\""
|
||||
delimiter='},{'
|
||||
|
||||
done
|
||||
echo -n '}]}') | wget -q -O- --post-data=`cat` http://localhost:8500/raw
|
||||
|
||||
echo
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue