fixes downloading files as .part

This commit is contained in:
Emily 2018-06-28 11:15:16 -07:00
parent 9472d5eaa6
commit 5f79a9fb6d

View File

@ -63,7 +63,7 @@ export default class FileReceiver extends Nanobus {
state = await reader.read(); state = await reader.read();
} }
return result.buffer; return result.slice(0, offset).buffer;
} }
async download(noSave = false) { async download(noSave = false) {
@ -85,10 +85,9 @@ export default class FileReceiver extends Nanobus {
this.emit('decrypting'); this.emit('decrypting');
const dec = await this.keychain.decryptStream(ciphertext); const dec = await this.keychain.decryptStream(ciphertext);
const plainstream = dec.stream;
const plaintext = await this.streamToArrayBuffer( const plaintext = await this.streamToArrayBuffer(
plainstream, dec.stream,
dec.streamInfo.fileSize this.fileInfo.size
); );
if (!noSave) { if (!noSave) {