mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
14 lines
335 B
JavaScript
14 lines
335 B
JavaScript
|
// The 2 magic bytes of the gzip header plus the mandatory compression type of DEFLATE
|
||
|
const magicBytes = [0x1f, 0x8b, 0x08];
|
||
|
|
||
|
function isBinaryFormat(rawData) {
|
||
|
for (let i = 0; i < magicBytes.length; ++i) {
|
||
|
if (magicBytes[i] !== rawData[i]) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
module.exports = { isBinaryFormat };
|