async function fileHasBinaryContents(location, expectedContents) { if (!(expectedContents instanceof Uint8Array)) { thrownew TypeError("expectedContents must be a byte array");
}
info(`Opening ${location} for reading`); const bytes = await IOUtils.read(location); return bytes.equals(expectedContents);
}
async function fileHasTextContents(location, expectedContents) { if (typeof expectedContents !== "string") { thrownew TypeError("expectedContents must be a string");
}
info(`Opening ${location} for reading`); const bytes = await IOUtils.read(location); const contents = new TextDecoder().decode(bytes); return contents === expectedContents;
}
async function fileExists(file) { try {
let { type } = await IOUtils.stat(file); return type === "regular";
} catch (ex) { returnfalse;
}
}
async function dirExists(dir) { try {
let { type } = await IOUtils.stat(dir); return type === "directory";
} catch (ex) { returnfalse;
}
}
async function cleanup(...files) { for (const file of files) {
await IOUtils.remove(file, {
ignoreAbsent: true,
recursive: true,
}); const exists = await IOUtils.exists(file);
ok(!exists, `Removed temporary file: ${file}`);
}
}
function sleep(ms) { returnnew Promise(resolve => setTimeout(resolve, ms));
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.