import { mongo } from "https://deno.land/x/hex@0.5.15/src/data/deps.ts";
const { GridFSBucket } = mongo;
Constructors
Create a new GridFSBucket object on @db with the given @options.
Methods
Given a @id, delete this stored file’s files collection document and associated chunks from a GridFS bucket.
Downloads the contents of the stored file specified by @id and writes the contents to the @destination Stream.
Drops the files and chunks collections associated with this bucket.
Find and return the files collection documents that match @filter.
Opens a Stream from which the application can read the contents of the stored file specified by @id.
Returns a Stream.
Opens a Stream that the application can write the contents of the file to. The driver generates the file id.
Returns a Stream to which the application will write the contents.
Note: this method is provided for backward compatibility. In languages that use generic type parameters, this method may be omitted since the TFileId type might not be an ObjectId.
Opens a Stream that the application can write the contents of the file to. The application provides a custom file id.
Returns a Stream to which the application will write the contents.
Uploads a user file to a GridFS bucket. The driver generates the file id.
Reads the contents of the user file from the @source Stream and uploads it as chunks in the chunks collection. After all the chunks have been uploaded, it creates a files collection document for @filename in the files collection.
Returns the id of the uploaded file.
Note: this method is provided for backward compatibility. In languages that use generic type parameters, this method may be omitted since the TFileId type might not be an ObjectId.
Uploads a user file to a GridFS bucket. The application supplies a custom file id.
Reads the contents of the user file from the @source Stream and uploads it as chunks in the chunks collection. After all the chunks have been uploaded, it creates a files collection document for @filename in the files collection.
Note: there is no need to return the id of the uploaded file because the application already supplied it as a parameter.