class documentation

class twisted.protocols.basic.FileSender: (source)

Implements interfaces: twisted.internet.interfaces.IProducer

View In Hierarchy

A producer that sends the contents of a file to a consumer.

This is a helper for protocols that, at some point, will take a file-like object, read its contents, and write them out to the network, optionally performing some transformation on the bytes in between.

Class Variable CHUNK_SIZE Undocumented
Instance Variable lastSent Undocumented
Instance Variable deferred Undocumented
Method beginFileTransfer Begin transferring a file
Instance Variable file Undocumented
Instance Variable consumer Undocumented
Instance Variable transform Undocumented
Method resumeProducing Undocumented
Method pauseProducing Undocumented
Method stopProducing Stop producing data.
CHUNK_SIZE = (source)

Undocumented

lastSent = (source)

Undocumented

deferred = (source)

Undocumented

def beginFileTransfer(self, file, consumer, transform=None): (source)

Begin transferring a file

ParametersfileThe file object to read data from (type: Any file-like object)
consumerThe object to write data to (type: Any implementor of IConsumer)
transformA callable taking one string argument and returning the same. All bytes read from the file are passed through this before being written to the consumer.
ReturnsA deferred whose callback will be invoked when the file has been completely written to the consumer. The last byte written to the consumer is passed to the callback. (type: Deferred)
file = (source)

Undocumented

consumer = (source)

Undocumented

transform = (source)

Undocumented

def resumeProducing(self): (source)

Undocumented

def pauseProducing(self): (source)

Undocumented

def stopProducing(self): (source)

Stop producing data.

This tells a producer that its consumer has died, so it must stop producing data for good.

API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.