# uo-node-utils

> Bunch of NodeJS tools

Latest version **0.1.1** (published 2015-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install uo-node-utils
pnpm add uo-node-utils
yarn add uo-node-utils
bun add uo-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.1.1 |
| Published | 2015-02-20 |
| First published | 2015-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ugo Onali |
| Maintainers | onaliugo |
| Keywords | node, nodejs, utils, tools |

## Links

- npm: https://www.npmjs.com/package/uo-node-utils
- Repository: https://github.com/onaliugo/node-utils
- Issues: https://github.com/onaliugo/node-utils/issues
- npm.io page: https://npm.io/package/uo-node-utils

## Dependencies (3)

- [del](https://npm.io/package/del.md) ^1.1.1
- [glob](https://npm.io/package/glob.md) ^4.3.2
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.0

## 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.1.1 (latest) — 2015-02-20
- 0.1.0 — 2015-02-18
- 0.0.41 — 2015-02-05
- 0.0.4 — 2015-02-03
- 0.0.30 — 2015-01-29
- 0.0.3 — 2015-01-28
- 0.0.23 — 2015-01-07
- 0.0.22 — 2015-01-07
- 0.0.21 — 2015-01-07
- 0.0.20 — 2015-01-07
- 0.0.2 — 2015-01-07
- 0.0.1 — 2015-01-07

## README

# Node-utils

**'uo-node-utils' is a bunch of tools for NodeJS**

**Feel free to contribute!**

```js
var Utils = require('uo-node-utils');

/* extend();
 * Extend Utils as you want.
 * You can also override methods
 * Support array as argument*/

Utils.extend({
	name: 'logger',
	content: function (str) {
		return console.log('[prefix] ' + str);
	}
});

Utils.extend([
	{
		name: 'logA',
		content: function () {
			console.log('__logA__');
			return 'logA';
		}
	},
	{
		name: 'logB',
		content: function () {
			console.log('__logB__');
			return 'logB';
		}
	}
]);

Utils.logA();
Utils.logB();



/* check.value();
 * check.fn();
 * Check typeof a value, or a returned value */

/* create.file();
 * Create a new file (even deep into a folder)

 * create.folder();
 * Create a folder
 * Support array as argument */

Utils.create.folder('my/new/folder');
Utils.create.file('my/new/folder/content.txt', 'Hello.');
Utils.create.file('other/folder/content.txt', 'You.');



/* each();
 * If no callback passed, return an array
 * Else, the callback will be executed for each file */

Utils.each('my/**/*');
// return [ 'my/new', 'my/new/folder', 'my/new/folder/content.txt' ];

Utils.each('my/**/*', function (path, i) {
	// console.log(path, i);
});



/* exist();
 * Test file or folder presence */

Utils.exist('my/');
// return true

Utils.exist('foo/');
// return false



/* read.file();
 * read.folder();
 * Read file and folder content(s) */

Utils.read.file('my/new/folder/content.txt');
// return 'Hello.'

Utils.read.folder('my/');
// return array



/* replaceInFile();
 * Replace content into a file */

Utils.replaceInFile('my/new/folder/content.txt', 'Hello.', 'H\nE\nL\nL\nO\n.');
// console.log( Utils.read.file('my/new/folder/content.txt') );



/* trim();
 * Trim a string or a file */

Utils.trim('H\nE\nL\nL\nO\n.');
// return HELLO.

Utils.trim('my/new/folder/content.txt');
// console.log( Utils.read.file('my/new/folder/content.txt') );



/* clear.file();
 * Remove content into a file

 * clear.folder();
 * Remove files into a folder
 * If folder doesn't exist, create it
 * Both support array as argument */

Utils.clear.file('my/new/folder/content.txt');
Utils.clear.folder('other');



/* del();
 * Remove any file and folders
 * Support array as argument */

Utils.del(['my', 'other']);

```

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