# ls-view

> ls-styled output for a list of files, with color and type suffixes

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

## Install

```sh
npm install ls-view
pnpm add ls-view
yarn add ls-view
bun add ls-view
```

## 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-10 |
| First published | 2015-06-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Eugene Sharygin |
| Maintainers | eush77 |
| Keywords | ls, file, directory, symlink, fifo, socket, filename, console, color, indicator, suffix, output, view |

## Links

- npm: https://www.npmjs.com/package/ls-view
- Repository: https://github.com/eush77/ls-view
- Issues: https://github.com/eush77/ls-view/issues
- npm.io page: https://npm.io/package/ls-view

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^1.0.0
- [cmpby](https://npm.io/package/cmpby.md) ^0.1.0
- [stable](https://npm.io/package/stable.md) ^0.1.5

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-06-10
- 0.0.1 — 2015-06-09

## README

[![npm](https://nodei.co/npm/ls-view.png)](https://nodei.co/npm/ls-view/)

# ls-view

[![Dependency Status][david-badge]][david]

Turns type-annotated list of files into ls-styled output. Applies colors and appends type indicators.

[david]: https://david-dm.org/eush77/ls-view
[david-badge]: https://david-dm.org/eush77/ls-view.png

## Example

```js
var lsView = require('ls-view');

lsView([
  { name: 'file1' },
  { name: 'link', type: 'symlink' },
  { name: 'file2' },
  { name: 'dir2', type: 'directory' },
  { name: 'dir1', type: 'directory' },
  { name: 'file3' },
  { name: 'a.out', type: 'executable' },
  { name: 'regular4' },
  { name: 'second-to-last5' },
  { name: 'the-last6' },
  { name: 'fifo', type: 'fifo' },
  { name: 's0cket', type: 'socket' }
])
```

![output](example/output.png)

## Type indicators

`ls-view` appends type indicators based on the table below.

| Type       | Suffix              |
| :--------: | :-----------------: |
| directory  | `/`                 |
| symlink    | `@`                 |
| executable | `*`                 |
| fifo       | <code>&#x7c;</code> |
| socket     | `=`                 |

## API

### `lsView(files, [opt])`

Turns list of files into a string. Each file is an object with `name` and (optional) `type` keys.

#### `opt.color`

Type: `Boolean`<br>
Default: `true`

Enables colorful output.

#### `opt.suffixes`

Type: `Boolean`<br>
Default: `true`

Enables type suffixes.

#### `opt.groupDirectoriesFirst`

Type: `Boolean`<br>
Default: `true`

Groups directories before files.

#### `opt.sort`

Type: `Boolean`<br>
Default: `true`

Sorts files by name.

### `lsView.suffixes`

Mapping from types to suffixes.

### `lsView.colors`

Mapping from types to color functions.

## Install

```
npm install ls-view
```

## License

MIT

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