public function downloadToStreamByName($filename, $destination, array $options = [])
    {
        if ( ! is_resource($destination) || get_resource_type($destination) != "stream") {
            throw InvalidArgumentException::invalidType('$destination', $destination, 'resource');
        }

        stream_copy_to_stream($this->openDownloadStreamByName($filename, $options), $destination);
    }
public function downloadToStreamByName($filename, $destination, array $options = [])
    {
        if ( ! is_resource($destination) || get_resource_type($destination) != "stream") {
            throw InvalidArgumentException::invalidType('$destination', $destination, 'resource');
        }

        stream_copy_to_stream($this->openDownloadStreamByName($filename, $options), $destination);
    }
public function downloadToStreamByName ( $ filename , $ destination , array $ options = [ ] ) { if ( ! is_resource ( $ destination ) || get_resource_type ( $ destination ) != "stream" ) { throw InvalidArgumentException :: invalidType ( '$destination' , $ destination , 'resource' ) ; } stream_copy_to_stream ( $ this -> openDownloadStreamByName ( $ filename , $ options ) , $ destination ) ; }
Writes the contents of a GridFS file, which is selected by name and
revision, to a writable stream.

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

@param string   $filename    Filename
@param resource $destination Writable Stream
@param array    $options     Download options
@throws FileNotFoundException if no file could be selected
@throws InvalidArgumentException if $destination is not a stream
@throws DriverRuntimeException for other driver errors (e.g. connection errors)
Writes the contents of a GridFS file which is selected by name and revision to a writable stream .