protected function writeStreamTask(Context $context, string $path, bool $append = false): \Generator
    {
        if (!yield $this->pool->submit($context, new MethodCall(static::class, 'checkFileWritableJob', $path, !$append && !$this->fileTransferSupported))) {
            throw new FilesystemException(\sprintf('File is not writable: "%s"', $path));
        }
        
        if (!$this->fileTransferSupported) {
            return new WritableFileStream($this->pool, $path);
        }
        
        $file = yield $this->pool->submit($context, new MethodCall(FileDescriptor::class, 'open', $path, $append ? 'ab' : 'wb'));
        
        return new WritableDescriptorStream($this->pool, $path, $file);
    }
protected function writeStreamTask(Context $context, string $path, bool $append = false): \Generator
    {
        if (!yield $this->pool->submit($context, new MethodCall(static::class, 'checkFileWritableJob', $path, !$append && !$this->fileTransferSupported))) {
            throw new FilesystemException(\sprintf('File is not writable: "%s"', $path));
        }
        
        if (!$this->fileTransferSupported) {
            return new WritableFileStream($this->pool, $path);
        }
        
        $file = yield $this->pool->submit($context, new MethodCall(FileDescriptor::class, 'open', $path, $append ? 'ab' : 'wb'));
        
        return new WritableDescriptorStream($this->pool, $path, $file);
    }
protected function writeStreamTask ( Context $ context , string $ path , bool $ append = false ) : \ Generator { if ( ! yield $ this -> pool -> submit ( $ context , new MethodCall ( static :: class , 'checkFileWritableJob' , $ path , ! $ append && ! $ this -> fileTransferSupported ) ) ) { throw new FilesystemException ( \ sprintf ( 'File is not writable: "%s"' , $ path ) ) ; } if ( ! $ this -> fileTransferSupported ) { return new WritableFileStream ( $ this -> pool , $ path ) ; } $ file = yield $ this -> pool -> submit ( $ context , new MethodCall ( FileDescriptor :: class , 'open' , $ path , $ append ? 'ab' : 'wb' ) ) ; return new WritableDescriptorStream ( $ this -> pool , $ path , $ file ) ; }
Open a file descriptor stream to be used for writing.

@param Context $context Async execution context.
@param string $path Absolute path to the target file.
@return WritableDescriptorStream Async readable file stream.
Open a file descriptor stream to be used for writing .