# @squirrel-forge/node-util

> Collection of node utilities

Latest version **1.6.0** (published 2022-09-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @squirrel-forge/node-util
pnpm add @squirrel-forge/node-util
yarn add @squirrel-forge/node-util
bun add @squirrel-forge/node-util
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.0 |
| Published | 2022-09-06 |
| First published | 2021-11-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10.0.0 |
| Dependencies | 0 |
| Unpacked size | 82 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Daniel Hartwell |
| Maintainers | dasiux |
| Keywords | node, utilities, cli, input, output |

## Links

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

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.6.0 (latest) — 2022-09-06
- 1.5.0 — 2022-09-06
- 1.4.2 — 2022-01-29
- 1.4.1 — 2022-01-28
- 1.3.0 — 2022-01-18
- 1.2.1 — 2022-01-16
- 1.2.0 — 2021-12-29
- 1.1.2 — 2021-12-19
- 1.1.1 — 2021-12-18
- 1.0.0 — 2021-12-05
- 0.6.1 — 2021-12-03
- 0.6.0 — 2021-11-27
- 0.5.5 — 2021-11-24
- 0.5.3 — 2021-11-22
- 0.5.2 — 2021-11-21
- … 1 more at https://npm.io/package/@squirrel-forge/node-util/versions

## README

# @squirrel-forge/node-util
Collection of basic node utilities, errors, terminal input, output, filesystem and more.

## Installation
```
npm i @squirrel-forge/node-util
```

## Usage
```
const { Class, function } = require( '@squirrel-forge/node-util' );
```

## Notes
In prepareation of node version support changes, dependencies are softened and must be specified and/or documented by packages requiring them.
[**Breaking changes**] since version *^1.4.0* all external dependencies were removed and made optional peer dependencies and therefore must be installed manually when required.

### Optional dependencies
These dependencies are optional and only required when using the mentioned methods or classes.
All of these must be installed manually, since they have been removed as direct dependencies.

 - [cli-spinner@^0.2.x](https://www.npmjs.com/package/cli-spinner/v/0.2.10)
   - *Progress*
 - [directory-tree@^3.x](https://www.npmjs.com/package/directory-tree/v/3.3.0)
   - *FsInterface.fileList*
 - [intercept-stdout@^0.1.x](https://www.npmjs.com/package/intercept-stdout/v/0.1.2)
   - *OutputBuffer*
   - *Progress*
 - [node-fetch@^2.x](https://www.npmjs.com/package/node-fetch/v/2.6.7) for *node 10.x*, use *node-fetch@^3.x* for later node versions. 
   - *FsInterface.remote*
   - *FsInterface.remoteText*
   - *FsInterface.remoteJSON*

### Classes
 - CliInput( cfx, args, trimQuotes, false, true )
   - trimQuotes : boolean 
   - hasArgs()
   - hasFlags()
   - flag( flag, default )
   - arg( index )
   - setArg( arg )
   - setFlag( flag )
   - getFlagsOptions( src )
   - eraseLastLine()
   - question( options )
   - ask( questions )
 - Exception( message, previous, options )
   - name : string
   - previous : *
   - stack : string
   - toString()
 - FsInterface : static
   - remote( url )*
   - remoteText( url )*
   - remoteJSON( url )*
   - read( file, enc )
   - readText( file )
   - readJSON( file )
   - exists( file, access )
   - write( file, content )
   - copy( source, target )
   - dir( dir )
   - isDir( dir )
   - unlink( file )
   - relative2root( dir, root )
   - filterOptions( options )
   - filterFiles( files, options )
   - files( dir, filter )
   - fileList( dir, options )*
   - fileListRecursive2Flat( tree, result )
   - treeWalker( tree, callback )
 - OutputBuffer()*
   - length : number
   - allowIntercept : boolean
   - flush()
   - reduce()
   - contents()
   - start()
   - end()
   - onIntercept( handler )
   - offIntercept( handler )
 - Progress()*
   - start( text, loop, safemode )
   - stop( keep )
 - StatsDisplay( cfx )
   - constructor
     - StatsDisplayException : StatsDisplayException constructor
     - StatsDisplayType : StatsDisplayType constructor
   - hasStyle( name )
   - styleAs( string, style, no-reset )
   - is_simple( value )
   - is_display_type( value )
   - show( value, result, level, heading )
   - parse( source, result )
   - display( source, output )
 - Timer
   - start( name )
   - get( name )
   - measure( name )
   - end( name )
 - Warning( message, previous, options ) extends Exception
   - name : string
   - previous : *
   - stack : string
   - toString()
   - toLocaleString()

### Functions
 - callback( name, context, args )
 - cmd( command )
 - convertBytes( bytes, decimals, style, return, unit )
 - convertHrtime( time, seconds_suffix_separrator, milliseconds_suffix, return )
 - isPojo( obj )
 - isUrl( string )
 - leadingZeros( number, length, char, reverse )
 - parseInput( args )
 - prompt( once )
 - rand( min, max )
 - requireOptional( name, version, fatal )
 - round( value, decimals )
 - simpleReplace( template, data, prefix, suffix )
 - strand()
 - strSlug( string )
 - trimChar( string, remove, limit )
 - wait( ms )

* Has dependency, see [optional dependencies](#optional-dependencies).

## Issues and docs
If you encounter any issues, please report [here](https://github.com/squirrel-forge/node-util/issues).

---
Check the sourcecode on [github](https://github.com/squirrel-forge/node-util) for detailed comments.

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