我正在尝试读取一个经过编码的文件,所以我正在执行以下代码:
'use strict';
const fs = require('fs');
const bencode = require('bencode');
let buffer = fs.readFileSync('file.torrent');
const torrent = bencode.decode(buffer);
console.log(torrent);
它总是返回相同的错误:
node index.js
C:\Users\carol\Desktop\dev\lauto-torrent\node_modules\bencode\lib\decode.js:114
throw new Error(
^
Error: Invalid data: Missing delimiter ":" [0x3a]
at Function.decode.find (C:\Users\carol\Desktop\dev\lauto-torrent\node_modules\bencode\lib\decode.js:114:9)
at Function.decode.buffer (C:\Users\carol\Desktop\dev\lauto-torrent\node_modules\bencode\lib\decode.js:159:20)
at Function.decode.dictionary (C:\Users\carol\Desktop\dev\lauto-torrent\node_modules\bencode\lib\decode.js:127:17)
at Function.decode.next (C:\Users\carol\Desktop\dev\lauto-torrent\node_modules\bencode\lib\decode.js:94:21)
at Function.decode.dictionary (C:\Users\carol\Desktop\dev\lauto-torrent\node_modules\bencode\lib\decode.js:127:36)
at Function.decode.next (C:\Users\carol\Desktop\dev\lauto-torrent\node_modules\bencode\lib\decode.js:94:21)
at Object.decode (C:\Users\carol\Desktop\dev\lauto-torrent\node_modules\bencode\lib\decode.js:83:17)
at Object.<anonymous> (C:\Users\carol\Desktop\dev\lauto-torrent\index.js:8:25)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
我一直在使用的 torrent 文件:
d8:announce33:http://explodie.org:6969/announce13:announce-listll33:http://explodie.org:6969/announceel32:http://tracker.tfile.me/announceel44:http://bigfoot1942.sektori.org:6969/announceel29:udp://eddie4.nl:6969/announceel40:udp://tracker4.piratux.com:6969/announceel40:udp://tracker.trackerfix.com:80/announceel33:udp://tracker.pomf.se:80/announceel38:udp://torrent.gresille.org:80/announceel30:udp://9.rarbg.me:2710/announceel49:udp://tracker.leechers-paradise.org:6969/announceel34:udp://glotorrents.pw:6969/announceel42:udp://tracker.opentrackr.org:1337/announceel44:udp://tracker.blackunicorn.xyz:6969/announceel48:udp://tracker.internetwarriors.net:1337/announceel34:udp://p4p.arenabg.ch:1337/announceel43:udp://tracker.coppersurfer.tk:6969/announceel30:udp://9.rarbg.to:2710/announceel44:udp://tracker.openbittorrent.com:80/announceel39:udp://ipv4.tracker.harry.lu:80/announceel39:udp://tracker.grepler.com:6969/announceel46:udp://public.popcorn-tracker.org:6969/announceel35:udp://p4p.arenabg.com:1337/announceel38:udp://tracker.zer0day.to:1337/announceel36:udp://shadowshq.yi.org:6969/announceel42:udp://tracker.pirateparty.gr:6969/announceel43:udp://tracker.coppersurfer.tk:1337/announceel41:udp://tracker.coppersurfer.tk:80/announceel30:udp://9.rarbg.to:2730/announceel30:udp://9.rarbg.to:2740/announceel30:udp://9.rarbg.to:2720/announceel30:udp://9.rarbg.me:2740/announceel30:udp://9.rarbg.me:2770/announceel32:udp://tracker.torrent.eu.org:451el41:udp://IPv6.open-internet.nl:6969/announceel42:udp://denis.stalker.upeer.me:1337/announceel36:udp://tracker.mg64.net:6969/announceel39:udp://inferno.demonoid.pw:3418/announceel38:udp://tracker.cyberia.is:6969/announceel28:udp://asnet.pw:2710/announceel39:udp://ipv6.tracker.harry.lu:80/announceel41:udp://tracker.torrent.eu.org:451/announceel39:udp://tracker.port443.xyz:6969/announceel35:udp://open.demonii.si:1337/announceel33:udp://tracker.qt.is:6969/announceel30:udp://9.rarbg.to:2770/announceel30:udp://9.rarbg.me:2730/announceel33:udp://tracker.ds.is:6969/announceel37:udp://exodus.desync.com:6969/announceel40:udp://tracker.tiny-vps.com:6969/announceel39:udp://tracker.justseed.it:1337/announceel32:udp://thetracker.org:80/announceel41:udp://tracker.vanitycore.co:6969/announceel42:udp://tracker.cypherpunks.ru:6969/announceel44:udp://tracker.open-internet.nl:6969/announceel33:udp://tracker.0o.is:6969/announceel38:udp://bt.xxx-tracker.com:2710/announceel33:udp://open.stealth.si:80/announceel35:http://share.camoe.cn:8080/announceel42:https://open.acgnxtracker.com:443/announceel35:http://tracker.tfile.co:80/announceel35:http://retracker.spb.ru:80/announceel37:http://open.acgnxtracker.com/announceel30:http://bt.acg.gg:1578/announceel39:http://tracker3.itzmx.com:8080/announceel34:udp://tracker.acg.gg:2710/announceee7:comment61:Torrent downloaded from torrent cache at http://itorrents.org10:created by16:BitTorrent/7.9.913:creation datei1494476222e8:encoding5:UTF-84:infod5:filesld6:lengthi7563720e4:pathl32:Paramore - After Laughter (2017)18:01. Hard Times.mp3eed6:lengthi8769544e4:pathl32:Paramore - After Laughter (2017)24:02. Rose-Colored Boy.mp3eed6:lengthi7813452e4:pathl32:Paramore - After Laughter (2017)19:03. Told You So.mp3eed6:lengthi9046432e4:pathl32:Paramore - After Laughter (2017)19:04. Forgiveness.mp3eed6:lengthi9683817e4:pathl32:Paramore - After Laughter (2017)18:05. Fake Happy.mp3eed6:lengthi9123736e4:pathl32:Paramore - After Laughter (2017)10:06. 26.mp3eed6:lengthi9566777e4:pathl32:Paramore - After Laughter (2017)12:07. Pool.mp3eed6:lengthi7753885e4:pathl32:Paramore - After Laughter (2017)15:08. Grudges.mp3eed6:lengthi8821797e4:pathl32:Paramore - After Laughter (2017)28:09. Caught In the Middle.mp3eed6:lengthi8192753e4:pathl32:Paramore - After Laughter (2017)20:10. Idle Worship.mp3eed6:lengthi8405906e4:pathl32:Paramore - After Laughter (2017)17:11. No Friend.mp3eed6:lengthi10663935e4:pathl32:Paramore - After Laughter (2017)19:12. Tell Me How.mp3eed6:lengthi55576e4:pathl32:Paramore - After Laughter (2017)9:Cover.jpgeee4:name46:Paramore - After Laughter (2017) [Mp3~320kbps]12:piece lengthi131072e6:pieces16100:.�Z��M���T�.Z��Mըs�߂F�� �u��Y?W*����M��}^���_/9~�����)���ק���v&�@�D�;<~�W��%)�D�@THNa��6�I#�d�S0@iuw�7��AY�J�ǎ7��ڶ��?�#UlWp�����9�ډ��~�H�c�l�LcL���c����A�a!Ûz��d]� Jy�# 1 �.�\m24Р�MM�ƚw�뇯z���YΣ�%�EfJ���,e���4yy�z�k�F�q.�5z�#ܶ��Ui�ͬ��TSYf���\�9
^�_��ٰ�.=�W\�j��([�_��
:).O����v�Hu������/�:}�:����|����D"ۮ��E_�,#���N�n�u<W���dqX��$+��?�u�\�[qa�;wI��B�=D^����3{��ts�����%�l�^sV`���Q:�D��/y"1�1�f��_�J�Z�W��J�;.���I��������3����nͦ��z�����m�!�|p��1-κ�ׄ�2������u����d0Ztϕ��$T����<?�
我检查了一个 torrent 解码器,看看我的文件是否损坏或是否有任何信息丢失,但看起来还不错