# osenv

> Look up environment settings specific to different operating systems

Latest version **0.1.5** (published 2018-02-16) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install osenv
pnpm add osenv
yarn add osenv
bun add osenv
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2018-02-16 |
| First published | 2012-06-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/osenv) |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 137 |
| Author | Isaac Z. Schlueter |
| Maintainers | iarna, isaacs, othiym23, robertkowalski |
| Keywords | environment, variable, home, tmpdir, path, prompt, ps1 |

## Links

- npm: https://www.npmjs.com/package/osenv
- Repository: https://github.com/npm/osenv
- Homepage: https://github.com/npm/osenv#readme
- Issues: https://github.com/npm/osenv/issues
- npm.io page: https://npm.io/package/osenv

## Dependencies (2)

- [os-tmpdir](https://npm.io/package/os-tmpdir.md) ^1.0.0
- [os-homedir](https://npm.io/package/os-homedir.md) ^1.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.5 (latest) — 2018-02-16
- 0.1.4 — 2016-12-13
- 0.1.3 — 2015-06-29
- 0.1.2 — 2015-06-12
- 0.1.1 — 2015-05-20
- 0.1.0 — 2014-05-26
- 0.0.3 — 2012-06-18
- 0.0.2 — 2012-06-18
- 0.0.1 — 2012-06-18

## README

# osenv

Look up environment settings specific to different operating systems.

## Usage

```javascript
var osenv = require('osenv')
var path = osenv.path()
var user = osenv.user()
// etc.

// Some things are not reliably in the env, and have a fallback command:
var h = osenv.hostname(function (er, hostname) {
  h = hostname
})
// This will still cause it to be memoized, so calling osenv.hostname()
// is now an immediate operation.

// You can always send a cb, which will get called in the nextTick
// if it's been memoized, or wait for the fallback data if it wasn't
// found in the environment.
osenv.hostname(function (er, hostname) {
  if (er) console.error('error looking up hostname')
  else console.log('this machine calls itself %s', hostname)
})
```

## osenv.hostname()

The machine name.  Calls `hostname` if not found.

## osenv.user()

The currently logged-in user.  Calls `whoami` if not found.

## osenv.prompt()

Either PS1 on unix, or PROMPT on Windows.

## osenv.tmpdir()

The place where temporary files should be created.

## osenv.home()

No place like it.

## osenv.path()

An array of the places that the operating system will search for
executables.

## osenv.editor() 

Return the executable name of the editor program.  This uses the EDITOR
and VISUAL environment variables, and falls back to `vi` on Unix, or
`notepad.exe` on Windows.

## osenv.shell()

The SHELL on Unix, which Windows calls the ComSpec.  Defaults to 'bash'
or 'cmd'.

---
_Source: https://npm.io/package/osenv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
