rm deprecated bufferutils
This commit is contained in:
parent
93b815c20e
commit
549b36bf1a
4 changed files with 22 additions and 207 deletions
|
@ -1,6 +1,3 @@
|
|||
var pushdata = require('pushdata-bitcoin')
|
||||
var varuint = require('varuint-bitcoin')
|
||||
|
||||
// https://github.com/feross/buffer/blob/master/index.js#L1127
|
||||
function verifuint (value, max) {
|
||||
if (typeof value !== 'number') throw new Error('cannot write a non-number as a number')
|
||||
|
@ -15,7 +12,6 @@ function readUInt64LE (buffer, offset) {
|
|||
b *= 0x100000000
|
||||
|
||||
verifuint(b + a, 0x001fffffffffffff)
|
||||
|
||||
return b + a
|
||||
}
|
||||
|
||||
|
@ -27,30 +23,7 @@ function writeUInt64LE (buffer, value, offset) {
|
|||
return offset + 8
|
||||
}
|
||||
|
||||
// TODO: remove in 4.0.0?
|
||||
function readVarInt (buffer, offset) {
|
||||
var result = varuint.decode(buffer, offset)
|
||||
|
||||
return {
|
||||
number: result,
|
||||
size: varuint.decode.bytes
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: remove in 4.0.0?
|
||||
function writeVarInt (buffer, number, offset) {
|
||||
varuint.encode(number, buffer, offset)
|
||||
return varuint.encode.bytes
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
pushDataSize: pushdata.encodingLength,
|
||||
readPushDataInt: pushdata.decode,
|
||||
readUInt64LE: readUInt64LE,
|
||||
readVarInt: readVarInt,
|
||||
varIntBuffer: varuint.encode,
|
||||
varIntSize: varuint.encodingLength,
|
||||
writePushDataInt: pushdata.encode,
|
||||
writeUInt64LE: writeUInt64LE,
|
||||
writeVarInt: writeVarInt
|
||||
writeUInt64LE: writeUInt64LE
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue