Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions lib/util/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

var buffer = require('buffer');
var assert = require('assert');
// var { promisify } = require('util');
// var exec = promisify(require('child_process').exec);
// var Buffer = require('buffer').Buffer;

var js = require('./js');
var $ = require('./preconditions');
Expand All @@ -19,6 +22,15 @@ function equals(a, b) {
return true;
}

function propBuffer(prop){
return new Buffer(prop);
// return newBuffer;
}

// function returnExec() {
// return exec;
// }

module.exports = {
/**
* Fill a buffer with a value.
Expand Down Expand Up @@ -75,15 +87,16 @@ module.exports = {
return result;
},


/**
* Concatenates a buffer
*
* Shortcut for <tt>buffer.Buffer.concat</tt>
*/
concat: buffer.Buffer.concat,

equals: equals,
equal: equals,
propBuffer: propBuffer,

/**
* Transforms a number from 0 to 255 into a Buffer of size 1 with that value
Expand Down Expand Up @@ -134,7 +147,7 @@ module.exports = {
},

/**
* Transforms a buffer into a string with a number in hex representation
* Transforms a buffer into a string with a number in hexa representation
*
* Shorthand for <tt>buffer.toString('hex')</tt>
*
Expand All @@ -160,7 +173,7 @@ module.exports = {
},

/**
* Transforms an hex encoded string into a Buffer with binary values
* Transforms an hexa encoded string into a Buffer with binary values
*
* Shorthand for <tt>Buffer(string, 'hex')</tt>
*
Expand All @@ -175,3 +188,4 @@ module.exports = {

module.exports.NULL_HASH = module.exports.fill(new Buffer(32), 0);
module.exports.EMPTY_BUFFER = new Buffer(0);

Loading