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

Extension API error thrown by bittorrent-swarm/bittorrent-protocol #228

Closed
sachanganesh opened this issue Dec 30, 2014 · 2 comments
Closed

Extension API error thrown by bittorrent-swarm/bittorrent-protocol #228

sachanganesh opened this issue Dec 30, 2014 · 2 comments

Comments

@sachanganesh
Copy link

@sachanganesh sachanganesh commented Dec 30, 2014

Hi! I'm developing a desktop app using node-webkit.

When running my code, I'm given this error:
Uncaught Error: Extension API requires a named function, e.g. function name() {}.

This is thrown from node_modules/webtorrent/node_modules/bittorrent-swarm/node_modules/bittorrent-protocol/index.js (130).

My code is simple:

function download(magnetUri) {
    console.log('downloading: ' + magnetUri);
    var WebTorrent = require('webtorrent');
    var client = new WebTorrent();

    client.download(magnetUri, function (torrent) {
        // Got torrent metadata!
        console.log('Torrent info hash:', torrent.infoHash)
        torrent.files.forEach(function (file) {
            // Get a url for each file
            console.log(file.name)
            file.getBlobURL(function (err, url) {
                if (err) throw err
                // Add a link to the page
                var a = document.createElement('a')
                a.download = file.name
                a.href = url
                a.textContent = 'Download ' + file.name
                document.body.appendChild(a)
            });
        });
    });
}

As I'm fairly new to this client, I'm not sure how to approach this issue.

Thanks in advance!

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 31, 2014

Please make sure you're using the latest version of webtorrent (0.19.1). This issue was fixed a while ago.

Let me know if you still encounter the issue with the latest version.

@sachanganesh

This comment has been minimized.

Copy link
Author

@sachanganesh sachanganesh commented Dec 31, 2014

Sorry about that and thank you!

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.