import { Bits } from '../types' ; import { p2 } from '../utilities' ; import read from './read' ; example param { Buffer } buffer param { Number } length param { Number } offset returns { Number } export default ( buffer , offset = 0 , length = 8 ) : number => { const arr = read ( buffer , offset , length ) ; let result = 0 ; for ( let i = 0 ; i < length ; i ++ ) result += arr [ i ] * p2 [ length - i - 1 ] ; return result ; } ;