# @asterics/node-utils

> node.js related utilities

Latest version **0.2.0** (published 2019-02-04) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @asterics/node-utils
pnpm add @asterics/node-utils
yarn add @asterics/node-utils
bun add @asterics/node-utils
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2019-02-04 |
| First published | 2019-01-27 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 38.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | AsTeRICS |
| Maintainers | alija, klues, madinaustria |
| Keywords | node, util |

## Links

- npm: https://www.npmjs.com/package/@asterics/node-utils
- Repository: https://github.com/asterics/node-utils
- Homepage: https://github.com/asterics/node-utils#readme
- Issues: https://github.com/asterics/node-utils/issues
- npm.io page: https://npm.io/package/@asterics/node-utils

## Dependencies (1)

- [shelljs](https://npm.io/package/shelljs.md) ^0.8.3

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2019-02-04
- 0.1.0 — 2019-01-28
- 0.0.2 — 2019-01-27
- 0.0.1 — 2019-01-27

## README

# node-utils

`node-utils` is a collection of methods tools for node.js, with the purpose of ensuring cross-platform support (Windows/Linux/OS X).

## Install

Install with npm:

    npm install --save-dev @asterics/node-utils

Install with yarn:

    yarn add @asterics/node-utils --dev

## Introduction

This package uses [`shelljs`](https://www.npmjs.com/package/shelljs), a portable implementation of the Unix shell for Windows, Linux and OS X.

## API Reference

### execute( { cmd, success, error, env, fatal, verbose } )

Execute `cmd`.

Available properties:

* `cmd`: Command to execute.
* `success`: Message on success.
* `error`: Message on error.
* `[env]`: Additional environment variables.
* `[fatal]`: Abort on error (default: false).
* `[verbose]`: Verbose logging (default: false).

#### Example

```javascript
const { execute } = require("@asterics/node-utils");

// -> bar
execute({
    cmd: "echo $FOO"
    success: "success!",
    error: "failure!",
    env: { FOO: "bar" },
    verbose: true
});
```

### mkdirp(path[, ...])

Create directory at `path` and required parent directories.

Available parameters:

* `path`: Absolute path to directory to create.

  **Note**: `path` must be an absolute path.

#### Example

````javascript
const { mkdirp } = require("@asterics/node-utils");

// Single directory
mkdirp("/home/admin/temp/foo");

// Multiple directories
mkdirp("/home/admin/temp/foo","/home/admin/temp/bar");
````

### hasShellCommand(command[, ...])

Check if `command` exists on the system.

Available properties:

* `command`: Shell command.

Returns:

`true` if provided `command` exist, `false` otherwise.

#### Example

```javascript
const { hasCommand } = require("@asterics/node-utils");

// Single command
hasCommand("git");

// Multiple commands
hasCommand("git","less","nano");
```

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