public function download($ftkey, $size, $passthru = false)
    {
        $this->init($ftkey);

        if ($passthru) {
            return $this->passthru($size);
        }

        $buff = new String("");
        $size = intval($size);
        $pack = 4096;

        Signal::getInstance()->emit("filetransferDownloadStarted", $ftkey, count($buff), $size);

        for ($seek = 0; $seek < $size;) {
            $rest = $size - $seek;
            $pack = $rest < $pack ? $rest : $pack;
            $data = $this->getTransport()->read($rest < $pack ? $rest : $pack);
            $seek = $seek + $pack;

            $buff->append($data);

            Signal::getInstance()->emit("filetransferDownloadProgress", $ftkey, count($buff), $size);
        }

        $this->getProfiler()->stop();

        Signal::getInstance()->emit("filetransferDownloadFinished", $ftkey, count($buff), $size);

        if (strlen($buff) != $size) {
            throw new Ts3Exception(
                "incomplete file download (" . count($buff) . " of " . $size . " bytes)"
            );
        }

        return $buff;
    }
public function download($ftkey, $size, $passthru = false)
    {
        $this->init($ftkey);

        if ($passthru) {
            return $this->passthru($size);
        }

        $buff = new String("");
        $size = intval($size);
        $pack = 4096;

        Signal::getInstance()->emit("filetransferDownloadStarted", $ftkey, count($buff), $size);

        for ($seek = 0; $seek < $size;) {
            $rest = $size - $seek;
            $pack = $rest < $pack ? $rest : $pack;
            $data = $this->getTransport()->read($rest < $pack ? $rest : $pack);
            $seek = $seek + $pack;

            $buff->append($data);

            Signal::getInstance()->emit("filetransferDownloadProgress", $ftkey, count($buff), $size);
        }

        $this->getProfiler()->stop();

        Signal::getInstance()->emit("filetransferDownloadFinished", $ftkey, count($buff), $size);

        if (strlen($buff) != $size) {
            throw new Ts3Exception(
                "incomplete file download (" . count($buff) . " of " . $size . " bytes)"
            );
        }

        return $buff;
    }
public function download ( $ ftkey , $ size , $ passthru = false ) { $ this -> init ( $ ftkey ) ; if ( $ passthru ) { return $ this -> passthru ( $ size ) ; } $ buff = new String ( "" ) ; $ size = intval ( $ size ) ; $ pack = 4096 ; Signal :: getInstance ( ) -> emit ( "filetransferDownloadStarted" , $ ftkey , count ( $ buff ) , $ size ) ; for ( $ seek = 0 ; $ seek < $ size ; ) { $ rest = $ size - $ seek ; $ pack = $ rest < $ pack ? $ rest : $ pack ; $ data = $ this -> getTransport ( ) -> read ( $ rest < $ pack ? $ rest : $ pack ) ; $ seek = $ seek + $ pack ; $ buff -> append ( $ data ) ; Signal :: getInstance ( ) -> emit ( "filetransferDownloadProgress" , $ ftkey , count ( $ buff ) , $ size ) ; } $ this -> getProfiler ( ) -> stop ( ) ; Signal :: getInstance ( ) -> emit ( "filetransferDownloadFinished" , $ ftkey , count ( $ buff ) , $ size ) ; if ( strlen ( $ buff ) != $ size ) { throw new Ts3Exception ( "incomplete file download (" . count ( $ buff ) . " of " . $ size . " bytes)" ) ; } return $ buff ; }
Returns the content of a downloaded file as a String object.

@param  string $ftkey
@param  integer $size
@param  boolean $passthru
@throws Ts3Exception
@return String
Returns the content of a downloaded file as a String object .