How you can Get a Base64 Model of a File From Command Line

Some time again I wrote an article on the best way to Convert Picture to Knowledge 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 utilize 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

Upon getting the file knowledge copied in base64 format, the URL format to make use of the information 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 information. I take advantage of them when creating shows or after I cannot rely on a good web connection.

  • CSS vs. JS Animation: Which is Faster?

    CSS vs. JS Animation: Which is Sooner?

    How is it attainable that JavaScript-based animation has secretly all the time been as quick — or quicker — than CSS transitions? And, how is it attainable that Adobe and Google constantly launch media-rich cell websites that rival the efficiency of native apps? This text serves as a point-by-point…

  • Introducing MooTools Templated

    Introducing MooTools Templated

    One main downside with creating UI parts with the MooTools JavaScript framework is that there is not a good way of permitting customization of template and ease of node creation. As of at this time, there are two methods of making: new Component Insanity The primary option to create UI-driven…

  • Chris Coyier: Some Amazing Work on CodePen III
  • MooTools, mediaboxAdvanced, and Mexico

    MooTools, mediaboxAdvanced, and Mexico

    The lightbox might be certainly one of my favourite components of the Net 2.0 revolution. No extra having to open new home windows (which may bathroom down your pc fairly a bit) to see a bigger picture, video, and so on. As an alternative, the merchandise hundreds proper into the…

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button