/**
* Writes the contents of a readable stream to a GridFS file.
*
* Supported options:
*
* * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the
* bucket's chunk size.
*
* @param string $filename Filename
* @param resource $source Readable stream
* @param array $options Stream options
*
* @return ObjectId ID of the newly created GridFS file
* @throws InvalidArgumentException
*/
public function uploadFromStream($filename, $source, array $options = [])
{
$options += ['chunkSizeBytes' => $this->options['chunkSizeBytes']];
$stream = new WritableStream($this->collectionWrapper, $filename, $options);
return $stream->uploadFromStream($source);
}