Commit eb05f9bd authored by Skye Yu's avatar Skye Yu

test:

parent 156a0202
...@@ -717,11 +717,11 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress) ...@@ -717,11 +717,11 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
let handler = (msg) => { let handler = (msg) => {
if (msg != null) { if (msg != null) {
flen += msg.body.length || msg.body.byteLength; flen += msg.body.length || msg.body.byteLength;
let hexString = Array.from(msg.body).map(b => b.toString(16).padStart(2, '0')).join(''); // let hexString = Array.from(msg.body).map(b => b.toString(16).padStart(2, '0')).join('');
let regex = /4869446f636b564d.*/; // let regex = /4869446f636b564d.*/;
let result = hexString.replace(regex, ''); // let result = hexString.replace(regex, '');
let data = new Uint8Array(result.match(/.{1,2}/g).map(byte => parseInt(byte, 16))); // let data = new Uint8Array(result.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
ondata(data); ondata(msg.body);
// return OK indicates all file blocks received // return OK indicates all file blocks received
if (flen >= length) return 'OK'; if (flen >= length) return 'OK';
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment