Mongo.GridFs.UploadStream (Mongodb v1.0.0) View Source
This is the upload stream for save streams into the grid fs.
First you need to create a bucket. The bucket contains the configuration for the grid fs.
Example:
streaming the file ./test/data/test.jpg
into the grid fs using the upload-stream
bucket = Bucket.new( pid )
upload_stream = Upload.open_upload_stream(bucket, "test.jpg", j: true)
src_filename = "./test/data/test.jpg"
File.stream!(src_filename, [], 512) |> Stream.into(upload_stream) |> Stream.run()
Link to this section Summary
Functions
Creates a new upload stream to insert a file into the grid-fs.
Link to this section Types
Specs
t() :: %Mongo.GridFs.UploadStream{ bucket: Mongo.GridFs.Bucket.t(), filename: String.t(), id: BSON.ObjectId.t(), metadata: {BSON.document() | nil} }
Link to this section Functions
Specs
new(Mongo.GridFs.Bucket.t(), String.t(), BSON.document() | nil) :: t()
Creates a new upload stream to insert a file into the grid-fs.