View Source Mongo.GridFs.Download (mongodb-driver v1.5.0)

The main entry point for downloading files from the grid-fs specified by the bucket struct.

Summary

Functions

Same as above, but returns also the file document.

Opens a Stream from which the application can read the contents of the stored file specified by fileId. The fileId can be a string, an ObjectId or just a map with the keys length and _id. In case of the map the function tries to stream the chunks described by the length and the _id values.

Types

@type result() ::
  {:error, :unknown}
  | {:error, :length_is_zero}
  | {:error, :not_found}
  | {:ok, Mongo.cursor()}

Functions

Link to this function

find_and_stream(bucket, file_id)

View Source
@spec find_and_stream(Mongo.GridFs.Bucket.t(), String.t()) ::
  {result(), BSON.document()}

Same as above, but returns also the file document.

Link to this function

find_one_file(bucket, filename)

View Source
Link to this function

open_download_stream(bucket, file_id)

View Source
@spec open_download_stream(
  Mongo.GridFs.Bucket.t(),
  String.t() | BSON.ObjectId.t() | map()
) :: result()

Opens a Stream from which the application can read the contents of the stored file specified by fileId. The fileId can be a string, an ObjectId or just a map with the keys length and _id. In case of the map the function tries to stream the chunks described by the length and the _id values.

Returns a Stream.