Viewing File: /home/ubuntu/walnutminds-ecom-frontend-base/node_modules/multibase/src/base16.js
'use strict'
const { Buffer } = require('buffer')
module.exports = function base16 (alphabet) {
return {
encode (input) {
if (typeof input === 'string') {
return Buffer.from(input).toString('hex')
}
return input.toString('hex')
},
decode (input) {
for (const char of input) {
if (alphabet.indexOf(char) < 0) {
throw new Error('invalid base16 character')
}
}
return Buffer.from(input, 'hex')
}
}
}
Back to Directory
File Manager