Wednesday, February 21, 2024
HomeSoftware DevelopmentEasy methods to Get a Base64 Model of a File From Command...

Easy methods to Get a Base64 Model of a File From Command Line

Some time again I wrote an article on how you can Convert Picture to Information URI with JavaScript. It is a neat trick builders can use for any variety of causes. As a substitute of abusing canvas, nonetheless, why not merely get the base64 knowledge from command line?

You need to use base64 and pbcopy to transform a file to base64 and replica it to the clipboard:

# base64 will get knowledge, pbcopy copies to clipboard
base64 -i emblem.jpeg | pbcopy

After you have the file knowledge copied in base64 format, the URL format to make use of the info is:

# knowledge:{mime-type};base64,{knowledge}

Whereas base64 knowledge and knowledge URIs do look cryptic, they’re helpful to keep away from making requests to different recordsdata. I exploit them when creating shows or once I cannot rely on a good web connection.

  • CSS Circles
  • Retrieve Google Analytics Visits and PageViews with PHP

    Google Analytics is an impressive web site analytics instrument that offers you far more details about your web site than you in all probability want. Higher to get greater than you need than not sufficient, proper? Anyhow I test my web site statistics extra usually than I ought to and…



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments