Skip to content

Decoding bencoded torrent files so that it can be viewed in human readable format

Notifications You must be signed in to change notification settings

dnyaneshwar89/bencode-decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bencode-decoder

Description

Bencode-decoder is a command line tool developed in Node.js that allows you to decode a bencoded string. This tool was developed with the thought of being able to decode torrent files but can be used to decode any other file types with are encoded using bencoding. It offers a set of commands to perform this tasks conveniently via the command line interface.

Getting Started

To start using bencode-decoder, follow these steps

git clone https://github.com/dnyaneshwar89/bencode-decoder.git

cd bencode-decoder

npm i

Examples

  • display help information:
 $ node index.js help

OUTPUT:

Usage: node index.js <options> <string | file_path>

Arguments:
string,file_path    			bencoded string or file_path to a bencoded string(torrent file)

Options:
-s                  			bencoded string to decode
-f                  			file path to file storing bencoded string to decode
-help, --help, help 			display help
  • decode a bencoded string
$ node index.js -s "d10:dictionaryd6:sample24:This a sample dictionarye7:integer2:074:listli1ei2ei3e1:4e6:string23:This is a sample stringe"

OUTPUT:

OUTPUT:
{
    "dictionary": {
        "sample": "This a sample dictionary"
    },
    "integer": "07",
    "list": [
        1,
        2,
        3,
        "4"
    ],
    "string": "This is a sample string"
}
  • decode a bencoded torrent file
$ node index.js -f ./sample.torrent

OUTPUT:

OUTPUT:
{
    "announce": "udp://tracker.openbittorrent.com:80",
    "creation date": 1327049827,
    "info": {
        "length": 20,
        "name": "sample.txt",
        "piece length": 65536,
        "pieces": "\\ÅæR¾\ræòx\u0005³\u0004dÿ�\u0000ô�ðÉ",
        "private": 1
    }
}

About

Decoding bencoded torrent files so that it can be viewed in human readable format

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published