PHP 8.2.30
Preview: bytesToUuid.js Size: 747 B
//usr/lib/node_modules/npm/node_modules/uuid/lib/bytesToUuid.js

/**
 * Convert array of 16 byte values to UUID string format of the form:
 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
 */
var byteToHex = [];
for (var i = 0; i < 256; ++i) {
  byteToHex[i] = (i + 0x100).toString(16).substr(1);
}

function bytesToUuid(buf, offset) {
  var i = offset || 0;
  var bth = byteToHex;
  // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
  return ([bth[buf[i++]], bth[buf[i++]], 
	bth[buf[i++]], bth[buf[i++]], '-',
	bth[buf[i++]], bth[buf[i++]], '-',
	bth[buf[i++]], bth[buf[i++]], '-',
	bth[buf[i++]], bth[buf[i++]], '-',
	bth[buf[i++]], bth[buf[i++]],
	bth[buf[i++]], bth[buf[i++]],
	bth[buf[i++]], bth[buf[i++]]]).join('');
}

module.exports = bytesToUuid;

Directory Contents

Dirs: 0 × Files: 8

Name Size Perms Modified Actions
747 B lrw-r--r-- 2021-03-10 14:36:37
Edit Download
6.66 KB lrw-r--r-- 2021-03-10 14:36:37
Edit Download
576 B lrw-r--r-- 2021-03-10 14:36:37
Edit Download
1.28 KB lrw-r--r-- 2021-03-10 14:36:37
Edit Download
246 B lrw-r--r-- 2021-03-10 14:36:37
Edit Download
2.28 KB lrw-r--r-- 2021-03-10 14:36:37
Edit Download
579 B lrw-r--r-- 2021-03-10 14:36:37
Edit Download
1.58 KB lrw-r--r-- 2021-03-10 14:36:37
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).