UNPKG

nefertiti-node

Version:

ES module to work with Nefertiti crypto trade bot.

50 lines (32 loc) 1.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.nefertitiURL = exports.executablePath = exports.executableName = exports.executable = exports.currentDirectory = void 0; var _url = require("url"); var _path = _interopRequireDefault(require("path")); var _getSysinfo = require("../helpers/get-sysinfo.js"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // in Browser, the URL in native accessible on window // Get the current working directory - replaces __dirname const currentDirectory = _path.default.join(_path.default.dirname((0, _url.fileURLToPath)(require('url').pathToFileURL(__filename).toString())), '..', '..'); // uses getPlatform and getArch to build the proper filename exports.currentDirectory = currentDirectory; const executableName = `nefertiti_${(0, _getSysinfo.getPlatform)()}_${(0, _getSysinfo.getArch)()}`; // executables are downloaded to [module_directory]/bin/ exports.executableName = executableName; const executablePath = _path.default.join(currentDirectory, 'bin'); // If on Windows, add a '.exe' to the @executableName exports.executablePath = executablePath; function addExtentionForWindows() { if (process.platform === 'win32') { return `${executableName}.exe`; } return executableName; } // build the full executable path, adding a '.exe' if on Windows const executable = _path.default.join(`${executablePath}`, addExtentionForWindows()); // export an object containing Nef's listen server properties exports.executable = executable; const nefertitiURL = { hostname: 'http://127.0.0.1', port: 38700, ping: '/ping', post: '/post' }; exports.nefertitiURL = nefertitiURL;