node-bencode icon indicating copy to clipboard operation
node-bencode copied to clipboard

add example code to decode torrent file

Open milahu opened this issue 2 years ago • 0 comments

the readme has examples only to decode strings, but not files

import fs from 'fs'
import bencode from 'bencode'

var buffer = fs.readFileSync('input.torrent')
var objectUtf8 = bencode.decode(buffer, 'utf8')
console.log(objectUtf8)

milahu avatar Aug 30 '23 20:08 milahu