Created
May 20, 2022 09:53
-
-
Save frenzzy/0c5797391cb663229e78712e4063b5cf to your computer and use it in GitHub Desktop.
Any file to base64 url cli tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var fs = require('fs'); | |
var mime = 'application/octet-stream'; | |
var encoding = 'base64'; | |
var data = fs.readFileSync(path.resolve(process.argv[process.argv.length - 2])).toString(encoding); | |
var uri = 'data:' + mime + ';' + encoding + ',' + data; | |
fs.writeFileSync(path.resolve(process.argv[process.argv.length - 1]), uri) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment