extracting data from mysql blobs and save to filesystem

whats the best way to extract binary data from a mysql blob field
and save in to the filesystem?

my intention is to extract some mysql blob fields, save them to disk, tar and gzip them and serve them with send_data.

nice if there would be a way to do this in memory without using files.