# @vimlet/commons-io

> IO utils

Latest version **0.1.4** (published 2022-10-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vimlet/commons-io
pnpm add @vimlet/commons-io
yarn add @vimlet/commons-io
bun add @vimlet/commons-io
```

## 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.4 |
| Published | 2022-10-17 |
| First published | 2019-03-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 15.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vimlet |
| Maintainers | lethevimlet, devsvimlet |
| Keywords | io |

## Links

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

## Dependencies (3)

- [glob](https://npm.io/package/glob.md) 7.1.2
- [rimraf](https://npm.io/package/rimraf.md) 2.6.2
- [fs-extra](https://npm.io/package/fs-extra.md) 5.0.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2022-10-17
- 0.1.3 — 2020-02-12
- 0.1.2 — 2019-03-28
- 0.1.1 — 2019-03-27
- 0.1.0 — 2019-03-27
- 0.0.12 — 2019-03-18
- 0.0.11 — 2019-03-15
- 0.0.10 — 2019-03-14
- 0.0.9 — 2019-03-13
- 0.0.8 — 2019-03-08

## README

# IO

Files handler.

## Installation

npm install @vimlet/commons-io

It will be also installed as a module within @vimlet/io

## Usage

> ## getFiles(dir, options)
> 
> Get files from directory and return an array of object with relative path and root folder. `[{root:"root_path",files:["file1_path","file2_path"...]}]`
> * dir: Array of patterns to search or single pattern.
> * options: 
> * - exclude: patterns to exclude from search 
> * - ignoreExtension: ignore file extensions 
> * - includeFolders: Boolean to include folders as paths, default false.

> ## absoluteFiles(index)
> 
> Return an array of absolute paths from a file index.
> * index: Array of objects with root and relative file paths. Like the result of getFiles.

> ## getRootFromPattern(pattern)
> 
> Get root from a pattern. Removes magic and file name.
> * pattern.

> ## isDirectory(path)
> 
> Check if a path is directory or file.
> * path.

> ## getFileSize(path)
> 
> Returns the size of a file.
> * path.

> ## deleteFolderRecursive(path, callback)
> 
> Delete a folder and its content.
> * path.
> * callback.

> ## deleteFolderRecursiveSync(path)
> 
> Delete a folder and its content.
> * path.

> ## deleteFolderRecursiveSync(path)
>
> Delete a folder and its content sync.
> * path
> ## deleteFolderRecursiveAsync(path)
>
> Delete a folder and its content async.
> * path

> ## isInPattern(path, pattern, options)
> 
> Check if a given path belongs to a pattern.
> * path.
> * pattern.
> * options: 
> * - exclude: patterns to exclude from search.

> ## writeToDisk(output, data, callback)
> 
> Write given data to disk.
> * output: Destination folder.
> * data: Data to write.
> * callback.

> ## getCommonBasePath(paths)
> 
> Return base path, what all have in common, for given paths.
> * paths.


## License
This project is under MIT License. See [LICENSE](https://github.com/vimlet/vimlet-commons/blob/master/LICENSE) for details.

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