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

Easy methods to Get a Base64 Model of a Record From Command Line
[ad_1]

Some time again I wrote an editorial on learn how to Convert Symbol to Knowledge URI with JavaScript. It is a neat trick builders can use for any choice of causes. As an alternative of abusing canvas, alternatively, why now not merely get the base64 knowledge from command line?

You’ll use base64 and pbcopy to transform a document to base64 and duplicate it to the clipboard:

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

After you have the document knowledge copied in base64 layout, the URL layout to make use of the information is:

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

Whilst base64 knowledge and information URIs do glance cryptic, they are helpful to steer clear of making requests to different information. I take advantage of them when developing shows or when I will be able to’t depend on a tight web connection.

  • JavaScript Promise API

    Whilst synchronous code is more uncomplicated to observe and debug, async is in most cases higher for efficiency and versatility. Why “hang up the display” when you’ll be able to cause a large number of requests without delay after which deal with them when every is in a position?  Guarantees are changing into a large a part of the JavaScript global…

  • I’m an Impostor

    That is the toughest factor I have ever needed to write, a lot much less admit to myself.  I have written resignation letters from jobs I have cherished, I have ended relationships, I have failed at a number of duties, and let myself down in my lifestyles.  All of the ones emotions had been very…

  • Event Delegation with MooTools

    Occasions play an enormous position in JavaScript. I will be able to’t title one site I have created previously two years that hasn’t used JavaScript match dealing with on some stage. Ask your self: how incessantly do I inject parts into the DOM and now not upload an…

  • New MooTools Plugin:  ElementFilter

    My new MooTools plugin, ElementFilter, supplies a good way so that you can permit customers to look throughout the textual content of any mixture of parts. Merely supply a textual content enter field and ElementFilter does the remainder of the paintings. The XHTML I have used a listing for this case…


[ad_2]
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back To Top
0
Would love your thoughts, please comment.x
()
x