MCPcopy
hub / github.com/agalwood/Motrix / handleFile

Method handleFile

src/main/Application.js:604–627  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

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()) {

Callers 3

initTrayManagerMethod · 0.95
handleCommandsMethod · 0.95
sendFileToApplicationMethod · 0.80

Calls 2

showMethod · 0.95
sendCommandToAllMethod · 0.95

Tested by

no test coverage detected