Skip to main content
Extremely Popular
Go to Latest
method GridFSBucket.prototype.uploadFromStream
import { GridFSBucket } from "https://deno.land/x/mongo@v0.31.0/mod.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