piece-length

2.0.1 • Public • Published

piece-length

piece-length finds the optimal piece length for a given number of bytes. Optimal for what exactly? BitTorrent. VuzeWiki and TorrentFreak have both released some examples of ideal piece lengths, and this algorithm will reproduce them.

build status

install

npm install piece-length

note: you may need to polyfill Math.log2

use

var optimum = require('piece-length')
 
// 350mb should be 256kb
optimum(367001600) // => 262144

obey

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.1
    3,245
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.1
    3,245
  • 2.0.0
    1
  • 1.0.1
    77
  • 1.0.0
    10
  • 0.0.0
    1

Package Sidebar

Install

npm i piece-length

Weekly Downloads

3,334

Version

2.0.1

License

MIT

Unpacked Size

1.36 kB

Total Files

3

Last publish

Collaborators

  • michaelrhodes