mongodb-driver v0.6.3 Mongo.GridFs.Download View Source

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

Link to this section 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.

Link to this section Types

Link to this type

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

Link to this section Functions

Link to this function

find_and_stream(bucket, file_id) View Source
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
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.