Property | Type | Description | |
---|---|---|---|
$collection | file collection to be used. |
Method | Description | |
---|---|---|
getBytes ( ) : string | Alias of Download::toString method. | |
getChunkCursor ( boolean $refresh = false ) : MongoDB\Driver\Cursor | Returns file chunks read cursor. | |
getChunkIterator ( boolean $refresh = false ) : Iterator | Returns iterator for the file chunks cursor. | |
getDocument ( ) : array | ||
getFilename ( ) : string | null | Returns associated file's filename. | |
getResource ( ) : resource | Returns persistent stream resource, which can be used to read file. | |
getSize ( ) : integer | Returns the size of the associated file. | |
setDocument ( array | MongoDB\BSON\ObjectID $document ) | Sets data of the document to be downloaded. | |
substr ( integer $start, integer $length ) : string | false | Return part of a file. | |
toFile ( string $filename ) : integer | Saves download to the physical file. | |
toResource ( ) : resource | Returns an opened stream resource, which can be used to read file. | |
toStream ( resource $stream ) : integer | Saves file into the given stream. | |
toString ( ) : string | Returns a string of the bytes in the associated file. | |
write ( string $filename ) : integer | Alias of Download::toFile method. |
public getChunkCursor ( boolean $refresh = false ) : MongoDB\Driver\Cursor | ||
$refresh | boolean | whether to recreate cursor, if it is already exist. |
return | MongoDB\Driver\Cursor | chuck list cursor. |
public getChunkIterator ( boolean $refresh = false ) : Iterator | ||
$refresh | boolean | whether to recreate iterator, if it is already exist. |
return | Iterator | chuck cursor iterator. |
public getFilename ( ) : string | null | ||
return | string | null | file name. |
public getResource ( ) : resource | ||
return | resource | file stream resource. |
public setDocument ( array | MongoDB\BSON\ObjectID $document ) | ||
$document | array | MongoDB\BSON\ObjectID | document raw data or document ID. |
public substr ( integer $start, integer $length ) : string | false | ||
$start | integer | reading start position. If non-negative, the returned string will start at the start'th position in file, counting from zero. If negative, the returned string will start at the start'th character from the end of file. |
$length | integer | number of bytes to read. If given and is positive, the string returned will contain at most length characters beginning from start (depending on the length of file). If given and is negative, then that many characters will be omitted from the end of file (after the start position has been calculated when a start is negative). |
return | string | false | the extracted part of file or `false` on failure |
public toResource ( ) : resource | ||
return | resource | stream resource. |