[GH-ISSUE #46] Posting a magent link using curl #252

Closed
opened 2026-03-15 02:40:47 +03:00 by kerem · 2 comments
Owner

Originally created by @kallaballa on GitHub (Jun 25, 2015).
Original GitHub issue: https://github.com/asapach/peerflix-server/issues/46

i'm trying to post a magent link via the rest api but all i get is this message:

TypeError: path must be a string
    at Object.fs.open (fs.js:427:11)
    at Object.fs.readFile (fs.js:206:6)
    at readTorrent (/usr/local/lib/node_modules/peerflix-server/node_modules/read-torrent/index.js:54:8)
    at EventEmitter._.extend.add (/usr/local/lib/node_modules/peerflix-server/server/store.js:36:5)
    at api.post.file (/usr/local/lib/node_modules/peerflix-server/server/index.js:67:9)
    at callbacks (/usr/local/lib/node_modules/peerflix-server/node_modules/express/lib/router/index.js:164:37)
    at param (/usr/local/lib/node_modules/peerflix-server/node_modules/express/lib/router/index.js:138:11)
    at pass (/usr/local/lib/node_modules/peerflix-server/node_modules/express/lib/router/index.js:145:5)
    at Router._dispatch (/usr/local/lib/node_modules/peerflix-server/node_modules/express/lib/router/index.js:173:5)
    at Object.router (/usr/local/lib/node_modules/peerflix-server/node_modules/express/lib/router/index.js:33:10)

I tried it like this:

curl --data '{"link":"magnet:?xt=urn:btih:EE0B41983C0A71E19B0CF06854CD5C7732D8D3BE&dn=jurassic+world+2015+hdts+v2+x264+ac3+cpg&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce"}' http://localhost:9000/torrents

any idea what i'm doing wrong?

Originally created by @kallaballa on GitHub (Jun 25, 2015). Original GitHub issue: https://github.com/asapach/peerflix-server/issues/46 i'm trying to post a magent link via the rest api but all i get is this message: ``` TypeError: path must be a string at Object.fs.open (fs.js:427:11) at Object.fs.readFile (fs.js:206:6) at readTorrent (/usr/local/lib/node_modules/peerflix-server/node_modules/read-torrent/index.js:54:8) at EventEmitter._.extend.add (/usr/local/lib/node_modules/peerflix-server/server/store.js:36:5) at api.post.file (/usr/local/lib/node_modules/peerflix-server/server/index.js:67:9) at callbacks (/usr/local/lib/node_modules/peerflix-server/node_modules/express/lib/router/index.js:164:37) at param (/usr/local/lib/node_modules/peerflix-server/node_modules/express/lib/router/index.js:138:11) at pass (/usr/local/lib/node_modules/peerflix-server/node_modules/express/lib/router/index.js:145:5) at Router._dispatch (/usr/local/lib/node_modules/peerflix-server/node_modules/express/lib/router/index.js:173:5) at Object.router (/usr/local/lib/node_modules/peerflix-server/node_modules/express/lib/router/index.js:33:10) ``` I tried it like this: ``` curl --data '{"link":"magnet:?xt=urn:btih:EE0B41983C0A71E19B0CF06854CD5C7732D8D3BE&dn=jurassic+world+2015+hdts+v2+x264+ac3+cpg&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce"}' http://localhost:9000/torrents ``` any idea what i'm doing wrong?
kerem closed this issue 2026-03-15 02:40:52 +03:00
Author
Owner

@asapach commented on GitHub (Jun 25, 2015):

Maybe try setting the correct content type? http://stackoverflow.com/a/7173011/6531

<!-- gh-comment-id:115193353 --> @asapach commented on GitHub (Jun 25, 2015): Maybe try setting the correct content type? http://stackoverflow.com/a/7173011/6531
Author
Owner

@kallaballa commented on GitHub (Jun 25, 2015):

Ah! thanks for the swift help. that did the trick.

curl -H "Content-Type: application/json" --data '{"link":"magnet:?xt=urn:btih:EE041983C0A71E19B0CF06854CD5C7732D8D3BE&dn=jurassic+world+2015+hdts+v2+x264+ac3+cpg&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce"}' http://localhost:9000/torrents
<!-- gh-comment-id:115195997 --> @kallaballa commented on GitHub (Jun 25, 2015): Ah! thanks for the swift help. that did the trick. ``` curl -H "Content-Type: application/json" --data '{"link":"magnet:?xt=urn:btih:EE041983C0A71E19B0CF06854CD5C7732D8D3BE&dn=jurassic+world+2015+hdts+v2+x264+ac3+cpg&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce"}' http://localhost:9000/torrents ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/peerflix-server#252
No description provided.