Share files
For every requested file:
- Require non-empty
SHAREFLARE_URLandSHAREFLARE_TOKEN. If either is unset, stop and name the missing variable. - Set
fileto the path and confirm it is a readable regular file. - Upload it and capture the response:
curl --fail-with-body --silent --show-error \
--data-binary "@$file" \
-H "Authorization: Bearer $SHAREFLARE_TOKEN" \
-H "Content-Type: $(file --brief --mime-type -- "$file")" \
"${SHAREFLARE_URL%/}/"
- Return the URL printed by the service. Completion means every requested file has one returned URL.
Keep SHAREFLARE_TOKEN out of output and files.