A suite to track Project Diva score statistics and ratings / D4DJ event data.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
projectdivar/server/node_modules/buffer-to-uint8array/index.js

12 lines
344 B

module.exports = function (buf) {
if (!buf) return undefined;
if (buf.constructor.name === 'Uint8Array'
|| buf.constructor === Uint8Array) {
return buf;
}
if (typeof buf === 'string') buf = Buffer(buf);
var a = new Uint8Array(buf.length);
for (var i = 0; i < buf.length; i++) a[i] = buf[i];
return a;
};