use FileBodyProducer for encrypt_blob script
This commit is contained in:
parent
7262e84150
commit
a3e5c61b50
1 changed files with 4 additions and 4 deletions
|
@ -5,6 +5,8 @@ import sys
|
||||||
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
from twisted.protocols import basic
|
||||||
|
from twisted.web.client import FileBodyProducer
|
||||||
|
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
from lbrynet.core import log_support
|
from lbrynet.core import log_support
|
||||||
|
@ -46,10 +48,8 @@ def encrypt_blob(filename, key, iv):
|
||||||
yield manager.setup()
|
yield manager.setup()
|
||||||
creator = CryptStreamCreator(manager, filename, key, iv_generator(iv))
|
creator = CryptStreamCreator(manager, filename, key, iv_generator(iv))
|
||||||
with open(filename, 'r') as infile:
|
with open(filename, 'r') as infile:
|
||||||
data = infile.read(2**14)
|
producer = FileBodyProducer(infile, readSize=2**22)
|
||||||
while data:
|
yield producer.startProducing(creator)
|
||||||
yield creator.write(data)
|
|
||||||
data = infile.read(2**14)
|
|
||||||
yield creator.stop()
|
yield creator.stop()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue