function makeScriptServer(scriptPath) { const server = new HttpServer();
server.registerContentType("sjs", "sjs");
server.registerFile("/", do_get_file(scriptPath));
server.start(-1); return server;
}
function withScriptServer(scriptPath) { return withServer(makeScriptServer(scriptPath));
}
function makeMockApiServer(directory) { const server = new HttpServer();
server.registerDirectory("/", directory);
server.setIndexHandler(async function (request, response) {
response.processAsync(); const dir = request.getProperty("directory"); const index = dir.clone();
index.append("index.json");
function withMockApiServer(apiName = "mock_api") { return withServer(makeMockApiServer(do_get_file(apiName)));
}
const CryptoUtils = {
_getHashStringForCrypto(aCrypto) { // return the two-digit hexadecimal code for a byte
let toHexString = charCode => ("0" + charCode.toString(16)).slice(-2);
// convert the binary hash data to a hex string.
let binary = aCrypto.finish(false);
let hash = Array.from(binary, c => toHexString(c.charCodeAt(0))); return hash.join("").toLowerCase();
},
/** * Get the computed hash for a given file * @param {nsIFile} file The file to be hashed * @param {string} [algorithm] The hashing algorithm to use
*/
getFileHash(file, algorithm = "sha256") { const crypto = CryptoHash(algorithm); const fis = new FileInputStream(file, -1, -1, false);
crypto.updateFromStream(fis, file.fileSize); const hash = this._getHashStringForCrypto(crypto);
fis.close(); return hash;
},
};
Messung V0.5
¤ Dauer der Verarbeitung: 0.0 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.