2.0.2 • Published 6 years ago

command-exists-promise v2.0.2

Weekly downloads
12,490
License
MIT
Repository
github
Last release
6 years ago

command-exists-promise

npm Travis (.com) AppVeyor
Node module to check if a command-line command exists. Forked from command-exists.

Installation

# For npm users
$ npm i command-exists-promise

# For yarn users
$ yarn add command-exists-promise

Usage

The function returns a promise that will resolve to true if the command exists and false if it doesn't.
On UNIX, the promise will resolve to true if the command is a path to an executable file. On Windows, it will resolve to true for any existing file.

Promise

const commandExists = require('command-exists-promise')

commandExists('ls')
  .then(exists => {
    if (exists) {
      // The command exists
    } else {
      // The command doesn't exist
    }
  })
  .catch(err => {
    // Should never happen but better handle it just in case
  })

Await

const commandExists = require('command-exists-promise')

try {
  const exists = await commandExists('ls')
  if (exists) {
    // The command exists
  } else {
    // The command doesn't exist
  }
} catch (err) {
  // Should never happen but better handle it just in case
}
rapid-git@mrjerz/plugin-scaffolder-backend@rbi-backstage/plugin-scaffolder-backend@infinitebrahmanuniverse/nolb-comma@everything-registry/sub-chunk-1360aio_jru_viewer-1.0.jarpuka-http-devpuka-http-printservicepuka-httpmoneybagz-bosornebyteslegalmpunoeva-erp-deskbusinessmanagementwolf.jsw3protectxcode-build-webpack-pluginstrabomicrovertex-online-system-erp@crowdin/clijimjdeploytestjdeploy-desktop-guijdeploy-pixelator-testjdeploy-swing-springboot-testjdeploy-test-aksjdeploy-test-framejdeploy-test-swingjeylastudiojhkjfsjfhdaskjjkjkljkljsjlkjskdflgjdklgfjjrlejgfdlskjgkldsfjlgjldkfsjglkfipsearch3install-saokna-wingeokeefx-samplerskibbykjgldskjglksjdslffgoriginal-sales-1-0staffattendance11surixipsearch2travelorderturing-machine-sim@ci-cmg/cruise-pack@codemech12345/team-tracker@codemech12345/team-tracker1@dawalters1/wolf.jsw-media-playertsl-club-matevh24softphone@lz129/node-red-contrib-xstate-machine@jrg/koa-sass@panter/catladdermpex-ucimonkeys-scrolling-shootermornich_timecountermyapplicationblablamonflabs-devtoolbox-premonflabs-jsplayground-premimsoft-respaldos-multiplataform-v2mindful-installernamerashaowlcms-firmataopenarkanoidparadr01d-deamdungparticlesimulationparticlesimulatorsaokna.winappsaokna.wingeoscenebuilderscenebuilder-lescenebuilder-leading-edgeserenityapplicationrobus_drawerrnartistsales-1-0samiserdoukreadgen-clipython-template-maker-kaminskesa.oknanode-red-contrib-xstate-machinenjreperf-sheetperf-boypontta-workerrespaldos-multiplataforma-swingrestaurant_management_systemqh.hmfx.u1reportmill16quic-load-generatorpuka-http-betar_launcherrearesshagus60_firstdsnapcodejavagjkkjkjljkljklgilfoyleimgayimgayimgayicc2gtaskstoolkithandbrake-watcherinstall-aksokna-wingeo
2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago