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

error: UV_ENOENT when using webtorrent #14234

Open
kaiser101 opened this issue Sep 28, 2024 · 0 comments
Open

error: UV_ENOENT when using webtorrent #14234

kaiser101 opened this issue Sep 28, 2024 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@kaiser101
Copy link

kaiser101 commented Sep 28, 2024

What version of Bun is running?

1.1.29+6d43b3662

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

index.js

`
import WebTorrent from 'webtorrent';

const client = new WebTorrent();
const magnet_url = '0D4AF725CC7CDF3CE933E5BFF8C0B3A6ED6E0D93';

const torrentOps = (magnetURI) => (torrent) => {
torrent.on('download', downloadOp(torrent));

torrent.on('done', doneOp(client, magnetURI, torrent));
};

client.add(
magnet_url,
{
announce: [
'udp://tracker.opentrackr.org:1337/announce',
'http://tracker.opentrackr.org:1337/announce',
'udp://open.demonii.com:1337/announce',
'udp://open.stealth.si:80/announce',
'udp://tracker.torrent.eu.org:451/announce',
'udp://exodus.desync.com:6969/announce',
'https://tracker.tamersunion.org:443/announce',
'udp://tracker1.bt.moack.co.kr:80/announce',
],
path: './torrents',
},
torrentOps(magnet_url)
);

const downloadOp = (torrent) => (bytes) => {
const { downloaded, downloadSpeed, progress, timeRemaining, infoHash } =
torrent;

console.info(downloadSpeed = ${downloadSpeed});
};

const doneOp = (client, magnetURI, torrent) => () => {
console.info(Torrent ${torrent.name} download finished);

client.remove(magnetURI, (err) => {
console.warn(err ?? 'Torrent removed');
});
};
`

package.json

{ "name": "webtorrent_sample", "version": "1.0.0", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "description": "", "dependencies": { "webtorrent": "^2.5.1" }, "type": "module", "trustedDependencies": [ "node-datachannel" ] }

What is the expected behavior?

Expected output is all torrent files are downloaded under the torrents folder. The same code works perfectly with node, without even having to add "trustedDependencies": ["node-datachannel"] in package.json

What do you see instead?

While running this with bun, the folders are created, but it gives an error while writing the files to disk.

error: UV_ENOENT
errno: -4058
syscall: "open"
path: "C:\Temp\Npm projects\webtorrent_sample\torrents\Python Programming And Maching Learning Understanding How To Code Within 24 Hours 2 In 1\Please Consider Making A Donation\QR Code For Donations.jpg"

Additional information

No response

@kaiser101 kaiser101 added bug Something isn't working needs triage labels Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant