(filePath)
| 602 | } |
| 603 | |
| 604 | handleFile (filePath) { |
| 605 | if (!filePath) { |
| 606 | return |
| 607 | } |
| 608 | |
| 609 | if (extname(filePath).toLowerCase() !== '.torrent') { |
| 610 | return |
| 611 | } |
| 612 | |
| 613 | this.show() |
| 614 | |
| 615 | const name = basename(filePath) |
| 616 | readFile(filePath, (err, data) => { |
| 617 | if (err) { |
| 618 | logger.warn(`[Motrix] read file error: ${filePath}`, err.message) |
| 619 | return |
| 620 | } |
| 621 | const dataURL = Buffer.from(data).toString('base64') |
| 622 | this.sendCommandToAll('application:new-bt-task-with-file', { |
| 623 | name, |
| 624 | dataURL |
| 625 | }) |
| 626 | }) |
| 627 | } |
| 628 | |
| 629 | initUpdaterManager () { |
| 630 | if (is.mas()) { |
no test coverage detected