Friday, October 13, 2023
HomeSoftware DevelopmentThe best way to Get a Base64 Model of a File From...

The best way to Get a Base64 Model of a File From Command Line


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

You should use base64 and pbcopy to transform a file to base64 and duplicate it to the clipboard:

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

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

# knowledge:{mime-type};base64,{knowledge}
knowledge:picture/jpeg;base64,/9j/4AAQSkZJRgAB......

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

  • 39 Shirts – Leaving Mozilla

    In 2001 I had simply graduated from a small city highschool and headed off to a small city school. I discovered myself within the quaint laptop lab the place the substandard computer systems featured two browsers: Web Explorer and Mozilla. It was this lab the place I fell…

  • 5 Awesome New Mozilla Technologies You’ve Never Heard Of

    My journey to Mozilla Summit 2013 was unimaginable.  I’ve spent a lot time specializing in my mission that I had overlooked all the nice work Mozillians had been placing out.  MozSummit supplied the proper reminder of how sensible my colleagues are and the way a lot…

  • Create a Simple Dojo Accordion

    Let’s be trustworthy:  although all of us giggle about how low-cost of a thrill JavaScript accordions have grow to be on the internet, they continue to be an efficient, helpful widget.  A lot of content material, small quantity of area.  Dojo’s Dijit library supplies an extremely merely methodology by which you’ll be able to…

  • Using MooTools to Instruct Google Analytics to Track Outbound Links

    Google Analytics supplies a wealth of details about who’s coming to your web site. One of the vital vital statistics the service supplies is the referrer statistic — you’ve got gotta know who’s sending folks to your web site, proper? What about the place you ship others although?



Supply hyperlink
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments