class documentation
class FileSender: (source)
Implements interfaces: twisted.internet.interfaces.IProducer
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.
Method | begin |
Begin transferring a file |
Method | pause |
Undocumented |
Method | resume |
Undocumented |
Method | stop |
Stop producing data. |
Constant | CHUNK |
Undocumented |
Instance Variable | consumer |
Undocumented |
Instance Variable | deferred |
Undocumented |
Instance Variable | file |
Undocumented |
Instance Variable | last |
Undocumented |
Instance Variable | transform |
Undocumented |
Begin transferring a file
Parameters | |
file:Any file-like object | The file object to read data from |
consumer:Any implementor of IConsumer | The object to write data to |
transform | A 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. |
Returns | |
Deferred | A 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. |