Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shinnn/home-files

List all files in the home directory
https://github.com/shinnn/home-files

async enumeration home javascript list nodejs promise

Last synced: 27 days ago
JSON representation

List all files in the home directory

Awesome Lists containing this project

README

        

# home-files

[![npm version](https://img.shields.io/npm/v/home-files.svg)](https://www.npmjs.com/package/home-files)
[![Build Status](https://travis-ci.org/shinnn/home-files.svg?branch=master)](https://travis-ci.org/shinnn/home-files)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/home-files.svg)](https://coveralls.io/github/shinnn/home-files?branch=master)

List all files in the [home directory](https://nodejs.org/api/os.html#os_os_homedir)

```javascript
const homeFiles = require('home-files');

(async () => await homeFiles() /* => Set {
'/Users/shinnn/.DS_Store',
'/Users/shinnn/.bash_history',
'/Users/shinnn/.bash_profile',
'/Users/shinnn/.bashrc',
'/Users/shinnn/.gitconfig',
...
'/Users/shinnn/.zshrc'
} */)();
```

## Installation

[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).

```
npm install home-files
```

## API

```javascript
const homeFiles = require('home-files');
```

### homeFiles([*options*])

*options*: `Object` (used as [`readdir-sorted` options](https://github.com/shinnn/readdir-sorted#readdirsortedpath--options))
Return: `Promise>`

The promise will be fulfilled with a [`Set`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set) of strings — absolute paths of all *files* included in the home directory. Symbolic links and directories are excluded.

Options are directly passed to the underlying [`readdir-sorted`](https://github.com/shinnn/readdir-sorted) to control the order of results.

## License

[ISC License](./LICENSE) © 2017 - 2018 Shinnosuke Watanabe