I'm using very often binary strings to read images, sounds, etc. directly for memory to avoid any file installation.
Here a small tool to convert any file to a base64 string incl. compression option to use it within your script to avoid usage of local disk (file install)! It will also created the needed functions!
Code is too long now for the code box -> Pastebin.com
Download: File to Base64 String Code Generator v1.20 Build 2015-01-20.7z (3043