binary files in node version

possible solution to node location problem
This commit is contained in:
Blue 2023-10-02 14:10:00 -03:00
parent d4f8b736ed
commit 7d0c2d079b
Signed by: blue
GPG key ID: 9B203B252A63EE38
5 changed files with 51 additions and 33 deletions

BIN
test/binary Normal file

Binary file not shown.

View file

@ -15,7 +15,7 @@ function test () {
let mimicry;
try {
mimicry = new Mimicry({
baseUrl: "test"
//baseUrl: "test"
});
global.mimicry = mimicry;
global.Mimicry = Mimicry;

View file

@ -3,11 +3,30 @@ mimicry.module([
"terminalModule",
"simple", Mimicry.Type.json,
"background", Mimicry.Type.css,
"text", Mimicry.Type.text
], function (global, [terminalModule, simple, background, text]) {
"text", Mimicry.Type.text,
"binary", Mimicry.Type.binary
], function (global, [terminalModule, simple, background, text, binary]) {
let bnr = false;
if (binary instanceof ArrayBuffer) {
const view = new Uint8Array(binary);
if (
view.length === 32 &&
view[0] === 0 &&
view[1] === 1 &&
view[3] === 3 &&
view[31] === 0x11 &&
view[30] === 0x10 &&
view[10] === 0x6e &&
view[12] === 0x72 &&
view[21] === 0x74
) {
bnr = true;
}
}
return [
terminalModule === "terminal",
simple.a[4] === 115,
text === "Lorem ipsum, I guess"
text === "Lorem ipsum, I guess",
bnr
];
});