superafroman / node-torrent Goto Github PK
View Code? Open in Web Editor NEWBittorrent client for node.js.
Bittorrent client for node.js.
[2015-10-05 13:35:15.305] [WARN] tracker.js - announce error from udp://tracker.istole.it:80/announce: bind EMFILE
[2015-10-05 13:35:15.305] [WARN] tracker.js - retry announce 'started' in 5s
It looks like it is a OS specific issue, and people seem to suggest the same solution:
http://superuser.com/questions/433746/is-there-a-fix-for-the-too-many-open-files-in-system-error-on-os-x-10-7-1
But still it does not work for everyone -me included, I still get the error-.
I have tried using graceful-js, but no luck.
Additionally, whenever I am running this sample code, my laptop becomes extremely hot and battery drains fast:
var Client = require('node-torrent');
var client = new Client({logLevel: 'DEBUG'});
var torrent = client.addTorrent('a.torrent');
// when the torrent completes, move it's files to another area
torrent.on('complete', function() {
console.log('complete!');
torrent.files.forEach(function(file) {
var newPath = '/new/path/' + file.path;
fs.rename(file.path, newPath);
// while still seeding need to make sure file.path points to the right place
file.path = newPath;
});
});
Has anyone used this library successfully on Mac OS? Is there a solution for the EMFILE error?
Hello,
I'm interested in using your code for another project especially when it comes to querying UDP trackers.
Is the UDP tracker querying working? In any case, would it be OK for me to extract it as a separate module (MIT licensed, with your name) ?
Uncaught node.js Error
RangeError: Port should be > 0 and < 65536
at connect (net.js:843:13)
at net.js:940:9
at dns.js:82:18
at process._tickCallback (node.js:382:11)
Trying to download file, but always get errors:
[2014-01-24 11:27:07.430] [WARN] tracker.js - announce error from http://bt.rutracker.org/ann?uk=0carlgMQCj: Unexpected status code: 403, response: <?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>403 - Forbidden</title>
</head>
<body>
<h1>403 - Forbidden</h1>
</body>
</html>
This is content of .torrent file:
d8:announce41:http://bt.rutracker.org/ann?uk=0carlgMQCj13:announce-listll41:http://bt.rutracker.org/ann?uk=0carlgMQCjel31:http://retracker.local/announceee7:comment49:http://rutracker.org/forum/viewtopic.php?t=64658910:created by13:uTorrent/177013:creation datei1202201366e8:encoding5:UTF-84:infod6:lengthi8239328e4:name34:Algorithms and data structure.djvu12:piece lengthi65536e6:pieces2520:г ЭЫЈгИ2�'�Јг�AдО� «ЅAў(ТfгщFо»њђ�B цф¬(‚о‡Ё@иЃўЗбЏЇ1D�! ’„w§ѕ MP�.рQ·aПy?Ѓкw™ЇWЋ2;†(сЬ/sл`fХЭаuи'Ёі�ЁML�ж��Гџм�“лЌG:Ь98�h1Р%;LГ1нж�€jр�ВПlг�З�Я‹ѓxs�аo�<о[ДТ�Ю�‡s�Ќ°�ГNюкч�д%;a™ФBx�g/ЦZ�In�T«&©UqХљЮ8ъ(.�†7$�єІї‹nЙ�z‚ШВ~�”�f�SИ]ЙWШ$°�Ъі±jЬjMcК†n�jЕЋьX ОWбп�YЦmT2М�{O�JBяN uacy�†'A7Ві/UпЄjgжўzsc�Гa�…Аvµ�gg›–�e‘ы”{тпtёеG0О�уЫ?ЉЕUQ�S�ёSК�ыо$п¶P+О�TШ଻<%Ш%.[АEµО�н—󵄓юЋ6�ZBЩґ{^TдA�Ѕi$`пWihU у�.5�МЪѓУхЏњ‚ќ!8ЈJ]хКъj№�*&Їi^� G�эxо$Ф({©3гцйЪYj;"ЉuA�h–. tЪu'ъN�:r�ч9q�sЈбЊ�Р)jUHЩ�•a«>л¦#}јвHѓ”3µѓ•�'�xwЖE{�$їl=ЌМ>нПtсI®PkҐ�ёљ�HШsмоЬ љњ…KЂu‡CО0[©†iAq�щ‹^‹лрo^?ЈXФy5cђПў($По��6€(ьЙhлlЙЅb�Аті»F�ч€�СH+э№эхиМ�-hўb‰”ЅЖ9Тзн№YЌш?o7^h�гКБ’П—@¦¬®Э<�¬йєbњы�0etпв�u�j‚C��ъe �aG›tMЖБw‡bs'у~?ЋA{Цђ20АТBeu¤БM�erRяCВ�М№'†хЦЮ$l|љ�ЛазШхr–¤лBрЏ`ЄzЖ¬ЮѕµMш��i0Б�µH1$‚Q�Q�/™G�щ&&ѕ:љn¬†DЦn�/А �g��Ц�яшe)QJRYz8�М®Unт�s«hВjс.Ґ�§Ђ'R�–‡IBб�Дд[�тLD�O–©f„б{Ґ�¶еsВ*�ЊЮ�Т+¬·rP)}‡O”�_П‰TЙ@'1>еУК;И]ЙКБ3¶w%ЁQоLґyЋ�T•еvЉN6§©m�(nµfЂ?cЦP•N �Mв!zf>‰д�Нл]ҐЉM�©?ђvо†у'б^сFэYї4Ќ�К�Књj"IrЊНrъуҐ�т;ЕGбcGТХп�Аџ†№‹кh�xќ#xђ�6ЫйМ/dЈ&°Z1ВўU� „�‰М4Т’c��'>†™'з#kБоЃЂa4{§ѕЉт�Zп¤\�Џ итлјxL6ЃљЛ�“^„6�g€юЃСЎј ф!�g;т��mђ СюёаHТ�ѓa+С�ЖM-bЦ ФB>w��ЉЩuЎl¶ V��Ј™’ўT” !mЅKќWЭъЗ—�S{юћCнЋ,хсэуcSдШ“�O|зVvZ&†ФЮqH�q€‘№1Ґ�<°ЬтI«�&H�±’•ЬЈј†Ы�]RКdАЬ3ќ©D[З„УВуьG†Оh~Ј±Ґюrбј;›ж§Zd�j�ъќф“�лaЌ–—‚\•QЎ‹{ы ЊY�- �R�ЬcѓБI�gГ¬фыOю�»Б!Ѓ�58уHо�NP"ЬНPҐшц>§ўЎqЪлс$’BУaW�ЋYp�pВ lЂє Ј�Ш¤оЌEw$’�ЭШнБ�їB`qЉt�яэ�аzџttЎшЅЅ�mSZыо$, І�bO�C:ь�—[�оj�±�ЭGЦЄяи»*Ўд6ѓ���Я { Ы3ћ/^аFFПЉ�ґ�‹�tOЖ[‰8NШЛхЩsхtaњХжўЂЊє В_b)Н'[Кэ_а]R[±�$®‰�).T�Їj�;Мcм%XIq±¶,i�Л%&-¶ке"NвX}0ukт±"\—A‰VSЗЌЪB}д‡krs¤m€HkGn+9ьWSэ’\�LЋ�‡С p lж=р nПxІєЩц�Єґkj(С1Ќ ¶�шйе%цHёС� tяѓчЦ�ҐfЪК*©j>ќ��ХSKНЊO�r_NЋ> JT�f–)п“р�њі'�ЬОШ»f™Џп�Ша#UнљGТЬЧъ•°uyЅЦd vXK¤ЎT5Щ¶†�чwPWV›ЈШЉ7�®UJ�Ж�Щ…у Ђ=‹7�}=ї�'¦^q;Љ,�'’tкі My‰4-D�^„uэЕ•јЦPЄH•\„Чi@иИw�ПХѕ� z凧 �°OdЦY sS:ыя"с'ЇwъjК¤В>JЂїЦ.ЋўµЂ'р`*F)y�Nж‹�н·№*ѓ�j€р€o@aЂ�ЂNѓ±
[2013-02-24 21:26:52.467] [DEBUG] http.js - Unexpected status code: 301, respons
e:
Hi. I get version 0.1.6 via npm.
It seems contain syntax error, but fortunately it is really minor issue.
In node-torrent\lib\piece.js line 180; it should be
self.complete = new BitField(self, self.complete.length);
self.requested = new BitField(self, self.complete.length);
:D
Hello, Im pretty new to programming with node and I was wondering if this module supports progress reports - like % downloaded
I tried to install this with npm
, but it took forever.
Turns out there is a 317M .mp4
file in there. Would you mind removing it?
Hello,
I've been playing around with the Tracker class alone for the UDP protocol. i've been trying to find peers off of udp://tracker.openbittorrent.com:80/announce.
The problem is, that hostname seems to map to several ipv4 DNS records, probably for load balancing purposes. However, when sending its UDP packets, node-torrent uses the hostname everytime which causes the DNS lookup to sometime resolve to another address. In the end, this results in "connection ID missmatch" error messages from the tracker.
A fix for this could be to dns.lookup()
the tracker's address once and for all at the begnning.
I use nodejs windows and return an error:
E:\node\torrent\node_modules\node-torrent\lib\piece.js:181
self.complete = new BitField(self,complete.length);
^
ReferenceError: complete is not defined
logs:
Listening for connections on {"address":"0.0.0.0","family":"IPv4","port":6881}
path.exists is now called fs.exists
.
[2012-10-05 10:00:46.540] [DEBUG] torrent.js - Finished validating pieces. Numb
er of valid pieces = 0 out of a total of 841
D:\PG\node-torrent\node_modules\node-torrent\lib\util\bencode.js:83
throw "Can't decode. No type starts with: "+ c;
^
Can't decode. No type starts with: <
I get this all the time.
Nice lib, any approximate date on when magnets will be supported?
This example only shows a way to move a downloaded file.
var Client = require('node-torrent');
var client = new Client({logLevel: 'DEBUG'});
var torrent = client.addTorrent('a.torrent');
// when the torrent completes, move it's files to another area
torrent.on('complete', function() {
console.log('complete!');
torrent.files.forEach(function(file) {
var newPath = '/new/path/' + file.path;
fs.rename(file.path, newPath);
// while still seeding need to make sure file.path points to the right place
file.path = newPath;
});
});
Hi,
It's my first time in git so please be patient ;-)
I'm using node-torrent lib and in node v0.8.* it was working ok but when I updated to v0.10.1 it's stops validating pieces.
I'm adding torrent and full file and I always get "Number of valid pieces = 0 out of a total of x". I was creating torrent i uTorrent and ctorrent. No luck.
Thanks for Help.
Piotr Balas
I'm getting this error when trying to download from a popular torrent site:
Unrecognized client. Please use a valid BitTorrent client.
I tried passing in an ID of a known torrent client like this:
var client = new Client({ logLevel: 'DEBUG', id: '-UT1610-'});
But haven't had much luck. Has anyone else seen this?
Hi @superafroman,
First of all, thanks for this great module!
I've downloaded the last version from npm (npm install node-torrent
) and it is clearly outdated, it doesn't contain the latest fixes.
Could you make a release with the latest code?
Thanks!
Best,
Guillermo.
Instances of node-torrent on multiple machines will happily share partial torrent data, but if an instance already has a complete copy of the files, it seems it won't participate as a seed unless the 'ready' event is emitted:
torrent.js, parse()
LOGGER.info('torrent already complete');
self.emit('ready');
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.