Skip to content

stbuehler/nodejs-dht-bencode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dht-bencode

bencode with Buffer()s from nodejs (as it is binary data javascript strings are not a good way to handle it)

install

npm install dht-bencode

usage

var bencode = require('dht-bencode');

bencode.bencode({ t: 'ab' }).toString(); // should result in "d1:t2:abe"
bencode.bdecode("d1:t2:abe"); // should result in { t: <Buffer 61 62> }

// you can also tell bdecode to ignore padding after the object
bencode.bdecode("7:contentpadding", true); // should result in { <Buffer("content")> }
// if you don't allow it, it will raise a bencode.PaddingError object (which has the
// parsed object in the .object property)

About

bencoding with Buffers instead of strings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published