pacman-app 0.3.0

A simple demonstration crate
Documentation
# Prepare JSON metadata
json='{"name":"my-crate","vers":"1.0.0"}'
json_len=$(printf "%s" "$json" | wc -c)
json_len_bin=$(printf "%08x" $json_len | xxd -r -p)

# Prepare crate file
crate_file="my-crate-1.0.0.crate"
crate_len=$(stat -f%z "$crate_file")
crate_len_bin=$(printf "%08x" $crate_len | xxd -r -p)

# Build the body
body=$( (echo -n "$json_len_bin"; echo -n "$json"; echo -n "$crate_len_bin"; cat "$crate_file") | base64 )

# Send the request
curl -X POST http://localhost:8000/api/v1/crates/new \
  -H "Content-Type: application/octet-stream" \
  --data-binary @"<(echo "$body" | base64 -d)"

  curl -X POST http://localhost:8000/api/v1/crates/new \
  -H "Content-Type: application/octet-stream" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-binary @"<(echo "$body" | base64 -d)"