View Source Mongo.GridFs.UploadStream (mongodb-driver v1.5.0)
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()
Summary
Functions
Creates a new upload stream to insert a file into the grid-fs.
Types
@type file_id() :: BSON.ObjectId.t() | binary()
@type t() :: %Mongo.GridFs.UploadStream{ bucket: Mongo.GridFs.Bucket.t(), filename: String.t(), id: file_id(), metadata: {BSON.document() | nil} }
Functions
@spec new(Mongo.GridFs.Bucket.t(), String.t(), BSON.document() | nil, file_id() | nil) :: t()
Creates a new upload stream to insert a file into the grid-fs.