# fs-sort

> Recursivly finds all files in path and create a list of all of those files orderded by the filter function provided

Latest version **0.1.0** (published 2015-06-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install fs-sort
pnpm add fs-sort
yarn add fs-sort
bun add fs-sort
```

## 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.0 |
| Published | 2015-06-11 |
| First published | 2015-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | thehobbit85 |
| Maintainers | thehobbit85 |
| Keywords | file system, filesystem, folder, size, file managment, folder managment |

## Links

- npm: https://www.npmjs.com/package/fs-sort
- Repository: https://github.com/Colored-Coins/fs-sort
- Issues: https://github.com/Colored-Coins/fs-sort/issues
- npm.io page: https://npm.io/package/fs-sort

## Dependencies (1)

- [minimatch](https://npm.io/package/minimatch.md) ^2.0.7

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-06-11

## README

# fs-sort
[![Build Status](https://travis-ci.org/Colored-Coins/fs-sort.svg?branch=master)](https://travis-ci.org/Colored-Coins/fs-sort) [![Coverage Status](https://coveralls.io/repos/Colored-Coins/fs-sort/badge.svg?branch=master)](https://coveralls.io/r/Colored-Coins/fs-sort?branch=master) [![npm version](https://badge.fury.io/js/fs-sort.svg)](http://badge.fury.io/js/fs-sort)

fs-sort recursivly finds all files in path and create a list of all of those files orderded by the filter function provided

### Installation

```sh
$ npm i fs-sort
```


### Get sorted files

Params:

  - path - Path to get files from
  - ignores - Array of file names to ignore
  - sortingFunction - The function that "chooses" what file property to use for sorting. sortingFunction receive the parameter fileObject which is in the form of:

```js
{
  fileName: "Name of the file, including the extension",
  fileStats: "File stats that dependes on the version of node you are running and the OS",
  fileFullPath: "Full file path to system root folder"
}
```

  - callback - A callback in the form of function(err, orderedFileList)

##### Example:

```js
var fs_sort = require('fs-sort')

var sortingFunction = function (fileObject) {
  return fileObject.fileName
}

fs_sort('/data', [], sortingFunction, function (err, list) {
  if (err) throw err
  for (var file in list) {
    console.log(list[file])
    // Will print something like this:
    // {
    //  fileName: '8.tmp',
    //  fileStats:
    //  {
    //    dev: 16777220,
    //    mode: 33188,
    //    nlink: 1,
    //    uid: 502,
    //    gid: 20,
    //    rdev: 0,
    //    blksize: 4096,
    //    ino: 21894243,
    //    size: 8230522,
    //    blocks: 16080,
    //    atime: Thu Jun 11 2015 03:27:26 GMT+0300 (IDT),
    //    mtime: Thu Jun 11 2015 03:27:26 GMT+0300 (IDT),
    //    ctime: Thu Jun 11 2015 03:27:26 GMT+0300 (IDT)
    //   },
    //   fileFullPath: '/Users/username/folder/data/8.tmp',
    //   mainAttribute: '8.tmp'
    // }
  }
})
```


### Testing

In order to test you need to install [mocha] globaly on your machine

```sh
$ cd /"module-path"/fs-sort
$ mocha
```


License
----

MIT

[mocha]:https://www.npmjs.com/package/mocha

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