mongo-ruby-driver/tests/mongo-qa/gridfs_out
2009-02-18 17:43:22 -05:00

18 lines
337 B
Ruby

#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '_common.rb')
require 'mongo/gridfs'
include XGen::Mongo::GridFS
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
input_file = ARGV[0]
output_file = ARGV[1]
File.open(output_file, "w") { |f|
GridStore.open(db, input_file, "r") { |g|
f.write(g.read)
}
}