/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ function openFileDialog(callback) { $("#open-file-input").off("change"); if (typeof callback != "undefined") { $("#open-file-input").on("change", function () { callback($("#open-file-input").val()); }); } $("#open-file-input").click(); } function getFileAsString(path) { const fs = require("fs"); return fs.readFileSync(path, "utf8"); } function getFileAsUint8Array(path) { const fs = require("fs"); return fs.readFileSync(path, null); } function writeStringToFile(path, text) { const fs = require("fs"); fs.writeFileSync(path, text); } function writeDataToFile(path, data) { const fs = require("fs"); fs.writeFileSync(path, data); } function copyFile(source, dest) { const fs = require("fs"); fs.copyFileSync(source, dest); } function getBasename(fullpath) { var path = require("path"); return path.basename(fullpath); }