Skip to main content
The Deno 2 Release Candidate is here
Learn more
Latest
method GridFSBucket.prototype.uploadFromStream
import { GridFSBucket } from "https://deno.land/x/model@v1.2/dependencies/mongo.ts";

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.

Parameters

filename: string
optional
options: GridFSUploadOptions