Initial commit

This commit is contained in:
CrazyMax
2019-09-20 22:23:45 +02:00
commit e28e23212c
778 changed files with 75786 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
module.exports = toBuffer
var makeBuffer = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from : bufferFrom
function bufferFrom (buf, enc) {
return new Buffer(buf, enc)
}
function toBuffer (buf, enc) {
if (Buffer.isBuffer(buf)) return buf
if (typeof buf === 'string') return makeBuffer(buf, enc)
if (Array.isArray(buf)) return makeBuffer(buf)
throw new Error('Input should be a buffer or a string')
}