Open lusm554 opened 3 years ago
Rewrite the function to send chunks in the correct order. https://github.com/f1le-transfer/cloud-storage/blob/507128ec31487420bc152ab4ac2c536f94ec7257/block-server/index.js#L94
function transferFile(file) { try { console.log('[FILE REQUEST]', file) const parse = path.parse(file.name) fs.promises.readdir(path.join(parse.dir, parse.name)) .then(chunks => { peerConnection.dataChannel.send(JSON.stringify({ len: chunks.length+1 })) return chunks }) .then(chunks => { chunks.forEach(chunk_name => { fs.createReadStream(path.join(parse.dir, parse.name, chunk_name)).on('data', data_chunk => { peerConnection.dataChannel.send(data_chunk) }) }) }) } catch (error) { console.log(error) } }
Rewrite the function to send chunks in the correct order. https://github.com/f1le-transfer/cloud-storage/blob/507128ec31487420bc152ab4ac2c536f94ec7257/block-server/index.js#L94