Calculates the bitrate given a file's size and duration
var bitrate = require('bitrate')
var bytes = 6076940
var seconds = 149
var kilobitsPerSecond = bitrate(bytes, seconds) // => 326.3
var bitsPerSecond = bitrate(bytes, seconds, 'bps') // => 326279
var BytesPerSecond = bitrate(bytes, seconds, 'Bps') // => 40785
var bitrate = require('bitrate')
bytes
is a number of bytesseconds
is a number of the duration in secondsformat
is a string of the desired format. Accepts:bps
,b/s
; bits per secondkbps
,kb/s
; kilobits per second defaultmbps
,mb/s
; megabits per secondBps
,B/s
; bytes per secondKBps
,KB/s
; kilobytes per secondMBps
,MB/s
; megabytes per second
- Returns
rate
number
With npm do:
npm install bitrate