@MikeSilvis Looks like filemagic (which is used in socialcast proper) will do this without having to write it out to a file: https://gist.github.com/seanwalbran/0862e945805a92e44a84