public function truncate($offset = 0, $cb = null, $pri = EIO_PRI_DEFAULT)
    {
        $cb = CallbackWrapper::forceWrap($cb);
        if (!$this->fd || $this->fd === -1) {
            if ($cb) {
                $cb($this, false);
            }
            return false;
        }
        if (!FileSystem::$supported) {
            $fp = fopen($this->path, 'r+');
            $r = $fp && ftruncate($fp, $offset);
            if ($cb) {
                $cb($this, $r);
            }
            return $r;
        }
        return eio_ftruncate($this->fd, $offset, $pri, $cb, $this);
    }
public function truncate($offset = 0, $cb = null, $pri = EIO_PRI_DEFAULT)
    {
        $cb = CallbackWrapper::forceWrap($cb);
        if (!$this->fd || $this->fd === -1) {
            if ($cb) {
                $cb($this, false);
            }
            return false;
        }
        if (!FileSystem::$supported) {
            $fp = fopen($this->path, 'r+');
            $r = $fp && ftruncate($fp, $offset);
            if ($cb) {
                $cb($this, $r);
            }
            return $r;
        }
        return eio_ftruncate($this->fd, $offset, $pri, $cb, $this);
    }
public function truncate ( $ offset = 0 , $ cb = null , $ pri = EIO_PRI_DEFAULT ) { $ cb = CallbackWrapper :: forceWrap ( $ cb ) ; if ( ! $ this -> fd || $ this -> fd === - 1 ) { if ( $ cb ) { $ cb ( $ this , false ) ; } return false ; } if ( ! FileSystem :: $ supported ) { $ fp = fopen ( $ this -> path , 'r+' ) ; $ r = $ fp && ftruncate ( $ fp , $ offset ) ; if ( $ cb ) { $ cb ( $ this , $ r ) ; } return $ r ; } return eio_ftruncate ( $ this -> fd , $ offset , $ pri , $ cb , $ this ) ; }
Truncates this file
@param  integer $offset Offset. Default is 0
@param  callable $cb Callback
@param  integer $pri Priority
@return resource|boolean
Truncates this file