Converting File to Variable — file2var

How many times have you faced scenarios where you need to compile an external file to a binary of a package for easy distribution? These scenarios can range from embedding malware to serving html files using a single binary/package.

 

Well now, I’ve developed a tool within my easyscript repository! It’s called file2var. Here’s file2var in action:

 

Basically file2var converts a file as a variable (currently support Golang only) so that it can be compiled or package within an application in its code. Here’s how it looks like when it converts its own source into Go:

 

Personally I think it’s pretty nifty and have decided to add it into my ‘easyscripts’ repository. Will be a good tool where I probably need it within my swiss army knife!

LEAVE A COMMENT