Skip to content

Instantly share code, notes, and snippets.

@skgsergio
Created January 23, 2024 17:52
Show Gist options
  • Save skgsergio/d5d230f5eb78e37be2a31f72e333d4d8 to your computer and use it in GitHub Desktop.
Save skgsergio/d5d230f5eb78e37be2a31f72e333d4d8 to your computer and use it in GitHub Desktop.
#!/bin/bash
mimetype=$(file -bN --mime-type "$1")
content=$(base64 -w0 < "$1")
echo "data:$mimetype;base64,$content"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment