# node-file-navigator

> Navigate through directories/files by filtering them and processing

Latest version **1.1.0** (published 2020-02-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-file-navigator
pnpm add node-file-navigator
yarn add node-file-navigator
bun add node-file-navigator
```

## 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.1.0 |
| Published | 2020-02-16 |
| First published | 2020-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Theekshana Wijesinghe |
| Maintainers | theekshanawj |
| Keywords | node, js, file, navigation |

## Links

- npm: https://www.npmjs.com/package/node-file-navigator
- Repository: https://github.com/theekshanawj/node-file-navigator
- Homepage: https://github.com/theekshanawj/node-file-navigator/blob/master/README.md
- Issues: https://github.com/theekshanawj/node-file-navigator/issues
- npm.io page: https://npm.io/package/node-file-navigator

## Recent versions

- 1.1.0 (latest) — 2020-02-16
- 1.0.1 — 2020-02-04
- 1.0.0 — 2020-02-04

## README

# Node file navigator
[![Build Status](https://api.travis-ci.com/theekshanawj/node-file-navigator.svg?branch=master)](https://api.travis-ci.com/theekshanawj/node-file-navigator)

This simple application will enable you to navigate through a directory; recursively if required, filtering files and directories and applying custom processing on the file selected.



## Required 

Stable NodeJS version

## Dependencies

None

## How to add to your application

Add [this](https://www.npmjs.com/package/node-file-navigator) module to your application as a dependency

```
npm i node-file-navigator
```

```javascript
const fileNavigator = require('node-file-navigator');
```

## API Reference

### Method invocation

```javascript
fileNavigator({ directory, fileSkipPattern, isRecursive, directorySkipPattern, callback, ...other })
```

### Paramaters

Parameter | Type | Usage | Example
--- | :--- | --- | --- | 
direcorty | `String` | directory for navigation | '/user/home/app'
fileSkipPattern | `Function : ({ path, stat })` | If returns `true` processing of the file is skipped | `({path}) => (/.css$/.test(path))`
isRecursive | `Boolean` | should navigate nested directories | `true`
directorySkipPattern | `Function : ({ path, stat })` | If returns `true` navigation of the directory is skipped | `({path}) => (/node_modules$/.test(path))`
callback | `Function: ({ path, stat})` | Define the file opration | `({ path }) => { console.log(path); }`
other | `Object` | N/A | N/A

### Example

```javascript
/**
 * An application to navigate through all .js files in the working directory
 * and nested directories and print the paths in the terminal without going through node_modules folder.
 *
*/
// Import 
const fileNavigator = require('node-file-navigator');

const directory = __dirname;
const fileSkipPattern = ({ path }) => !/.js$/.test(path);
const isRecursive = true;
const directorySkipPattern = ({ path }) => /node_modules/.test(path);
const callback = ({ path }) => { console.log(path); }

// Invoke
await fileNavigator({ directory, fileSkipPattern, isRecursive, directorySkipPattern, callback });

```

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