- Reference >
- MongoDB\GridFS\Bucket Class >
- MongoDB\GridFS\Bucket::openDownloadStream()
MongoDB\GridFS\Bucket::openDownloadStream()
On this page
Definition
-
MongoDB\GridFS\Bucket::openDownloadStream
Selects a GridFS file by its
_id
and opens it as a readable stream.This method has the following parameters:
Parameter Type Description $id
mixed The _id
of the file.
Return Values
A readable stream resource.
Errors/Exceptions
MongoDB\GridFS\Exception\FileNotFoundException
if no file was
found for the selection criteria.
MongoDB\Driver\Exception\RuntimeException for other errors at the driver level (e.g. connection errors).
Examples
The output would then resemble: