add example code to decode torrent file

Open Beginner friendly
#162 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
62/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript, node.js
Domain
documentation

Research direction

Open the README and review the existing examples that decode strings. Add a comparable example for reading and decoding a torrent file using the JavaScript shown in the issue, then verify the README clearly demonstrates file decoding.

Written by the indexing model from the issue text.

Description

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)
Dominant language
JavaScript
Stars
173
Forks
38
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from webtorrent/node-bencode

All issues in webtorrent/node-bencode

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.