Phalcon\Db\Adapter\MongoDB\GridFS\Bucket::downloadToStreamByName PHP Method

downloadToStreamByName() public method

Supported options: * revision (integer): Which revision (i.e. documents with the same filename and different uploadDate) of the file to retrieve. Defaults to -1 (i.e. the most recent revision). Revision numbers are defined as follows: * 0 = the original stored file * 1 = the first revision * 2 = the second revision * etc… * -2 = the second most recent revision * -1 = the most recent revision
public downloadToStreamByName ( string $filename, resource $destination, array $options = [] )
$filename string Filename
$destination resource Writable Stream
$options array Download options
    public function downloadToStreamByName($filename, $destination, array $options = [])
    {
        $options += ['revision' => -1];
        $file = $this->collectionWrapper->findFileByFilenameAndRevision($filename, $options['revision']);
        if ($file === null) {
            throw FileNotFoundException::byFilenameAndRevision($filename, $options['revision'], $this->getFilesNamespace());
        }
        $stream = new ReadableStream($this->collectionWrapper, $file);
        $stream->downloadToStream($destination);
    }