This commit is contained in:
Alexey Kasyanchuk 2018-08-31 06:37:25 +03:00
parent 2f42af54ed
commit cdfed5ae38

View File

@ -132,7 +132,7 @@ class p2p {
}); });
}); });
this.on('file', (path, callback) => { this.on('file', ({path}, callback) => {
const readable = new fs.ReadStream(path) const readable = new fs.ReadStream(path)
logT('transfer', 'server transfer file', path) logT('transfer', 'server transfer file', path)
readable.on('data', (chunk) => { readable.on('data', (chunk) => {
@ -382,7 +382,7 @@ class p2p {
file(peer, path) file(peer, path)
{ {
const fileStream = fs.createWriteStream(path) const fileStream = fs.createWriteStream(path)
let deleteCallback = peer.emit('file', path, (chunk) => { let deleteCallback = peer.emit('file', {path}, (chunk) => {
if(!chunk) if(!chunk)
{ {
logT('transfer', 'closing transfering file stream', path) logT('transfer', 'closing transfering file stream', path)