class KPM::Blob

def initialize(value, tmp_dir)

def initialize(value, tmp_dir)
  @tmp_dir = tmp_dir
  @blob_file = @tmp_dir + File::SEPARATOR + rand.to_s
  # Make sure directory is 'rx' for others to allow LOAD_FILE to work
  FileUtils.chmod('a+rx', @tmp_dir)
  store_value(value)
end

def store_value(value)

def store_value(value)
  File.open(@blob_file, 'wb') do |file|
    file.write(value)
  end
end

def value

secure_file_priv=""
...
[mysqld]
e.g /usr/local/etc/my.cnf :

On Macos systems, this will require defining a `secure_file_priv` config:
def value
  "LOAD_FILE(\"#{@blob_file}\")"
end