You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.d.ts 844B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. declare namespace binVersion {
  2. interface Options {
  3. /**
  4. The arguments to pass to `binary` so that it will print its version.
  5. @default ['--version']
  6. */
  7. args?: string[];
  8. }
  9. }
  10. /**
  11. Get the version of a binary in [semver](https://github.com/npm/node-semver) format.
  12. @param binary - The name of or path to the binary to get the version from.
  13. @returns The version of the `binary`.
  14. @example
  15. ```
  16. import binVersion = require('bin-version');
  17. (async () => {
  18. // $ curl --version
  19. // curl 7.30.0 (x86_64-apple-darwin13.0)
  20. console.log(await binVersion('curl'));
  21. //=> '7.30.0'
  22. // $ openssl version
  23. // OpenSSL 1.0.2d 9 Jul 2015
  24. console.log(await binVersion('openssl', {args: ['version']}));
  25. //=> '1.0.2'
  26. })();
  27. ```
  28. */
  29. declare function binVersion(
  30. binary: string,
  31. options?: binVersion.Options
  32. ): Promise<string>;
  33. export = binVersion;