to-executable-name
Version:
Append .exe to a given string if the program is running on a Windows environment
57 lines (37 loc) • 1.58 kB
Markdown
//img.shields.io/npm/v/to-executable-name.svg)](https://www.npmjs.com/package/to-executable-name)
[](https://travis-ci.org/shinnn/to-executable-name)
[](https://ci.appveyor.com/project/ShinnosukeWatanabe/to-executable-name/branch/master)
[](https://coveralls.io/github/shinnn/to-executable-name)
Append `.exe` to a given string if the program is running on a [Windows](https://www.microsoft.com/windows) environment
```javascript
const toExecutableName = require('to-executable-name');
// On Windows
toExecutableName('node'); //=> 'node.exe'
// Otherwise
toExecutableName('node'); //=> 'node'
```
[ ](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).
```
npm install to-executable-name
```
```javascript
const toExecutableName = require('to-executable-name');
```
*binName*: `string`
*option*: `Object`
Return: `String`
Type: `string`
Default: `.exe`
A file extension that will be appended to the string on Windows.
```javascript
// On Windows
toExecutableName('foo'); //=> 'foo.exe'
toExecutableName('foo', {win32Ext: '.bat'}); //=> 'foo.bat'
```
[ ](./LICENSE) © 2017 Shinnosuke Watanabe
[![npm version](https: