Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
if [ -z "$1" ]; then
echo "usage: data-url file" >&2
exit 1
fi
mimetype=$(file -bN --mime-type "$1")
content=$(base64 < "$1")
echo "data:$mimetype;base64,$content"
@Fortyseven

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment