Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"cb() is not a function" on engine.remove #143

Closed
giacomocerquone opened this issue Nov 5, 2015 · 5 comments · May be fixed by #144
Closed

"cb() is not a function" on engine.remove #143

giacomocerquone opened this issue Nov 5, 2015 · 5 comments · May be fixed by #144

Comments

@giacomocerquone
Copy link
Contributor

Hello, so I'm trying to call engine.remove() once the engine is created and it's downloading but it won't work.
I tried to call it with:

engine.remove()

and it returns:

node_modules\torrent-stream\index.js:718
        cb()
        ^

TypeError: cb is not a function
    at FSReqWrap.oncomplete (C:\Users\...\node_modules\torrent-stream\index.js:718:9)

I tried also

engine.remove([], function() {
    console.log("removed");
});

or

engine.remove(function() {
    console.log("removed");
});

and nothing happens, like I've never called this method. Is it possible that something is wrong there in the library?
Thank you :)

@mafintosh
Copy link
Owner

Did you fix this? :)

@giacomocerquone
Copy link
Contributor Author

I don't think it was actually a problem of the library but a strange behaviour. In fact calling engine.remove the file were deleted but the swarm continued to download stuff (and I didn't even know where this stuff were downloaded).
So I fixed this calling engine.destroy() for first and engine.remove() right after.

PS = and the callback should be specified that is not facultative, if you don't put it, the error specified above will return.

@mafintosh
Copy link
Owner

Oh okay. I guess .remove should call .destroy for you. If you wanna PR that I'd merge it.

@giacomocerquone
Copy link
Contributor Author

Ok, give me some time please because I would like also to check that callback and make it an optional paramater if it is ok for you.

@mafintosh
Copy link
Owner

Sounds good

On Sun, Nov 8, 2015 at 2:34 AM Giacomo Cerquone notifications@github.com
wrote:

Ok, give me some time please because I would like also to check that
callback and make it an optional paramater if it is ok for you.


Reply to this email directly or view it on GitHub
#143 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants