Replace stream.tee() with stream.clone()

Also some other fixes to pass more tests.
This commit is contained in:
Daniel Huigens
2018-05-16 18:50:28 +02:00
parent 3475843d82
commit db39e616ca
9 changed files with 72 additions and 57 deletions

View File

@@ -215,13 +215,13 @@ function dearmor(input) {
let text = [];
let textDone;
let controller;
let [data, dataClone] = stream.tee(base64.decode(new ReadableStream({
let data = base64.decode(new ReadableStream({
async start(_controller) {
controller = _controller;
}
})));
}));
let checksum;
const checksumVerified = getCheckSum(dataClone);
const checksumVerified = getCheckSum(stream.clone(data));
data = stream.getReader(data).substream(); // Convert to Stream
data = stream.transform(data, value => value, async () => {
const checksumVerifiedString = await stream.readToEnd(checksumVerified);
@@ -303,8 +303,7 @@ function armor(messagetype, body, partindex, parttotal, customComment) {
hash = body.hash;
body = body.data;
}
let bodyClone;
[body, bodyClone] = stream.tee(body);
const bodyClone = stream.clone(body);
const result = [];
switch (messagetype) {
case enums.armor.multipart_section: