mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-04 04:35:29 +00:00
feat(fish): convert a few functions
This commit is contained in:
7
fish/functions/dataUrl.fish
Normal file
7
fish/functions/dataUrl.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
function dataUrl --description "Create a data URL from a file"
|
||||
set mimeType (file -b --mime-type $argv)
|
||||
if string match -r '^text/' $mimeType
|
||||
set mimeType "$mimeType;charset=utf-8"
|
||||
end
|
||||
echo "data:$mimeType;base64,(openssl base64 -in $argv | tr -d '\n')"
|
||||
end
|
||||
Reference in New Issue
Block a user