google-datastore-emulator
Version:
NodeJs wrapper to google datastore emulator. It could start and stop emulator as node module
21 lines (16 loc) • 423 B
JavaScript
const DEFAULT_PORT = 8081;
/**
* If the preferredPort provided then returns with it otherwise try to find a free port
*
* @param preferredPort
* @returns {Promise<number|*>}
*/
async function getEmulatorPort(preferredPort) {
if (preferredPort)
return preferredPort;
const { default: getPort } = await import('get-port');
return getPort({
port: DEFAULT_PORT,
});
}
module.exports = getEmulatorPort;