JSPM

ls-view

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q48503F
  • License MIT

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

Package Exports

  • ls-view

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ls-view) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm

ls-view

Dependency Status

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

Example

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

Type indicators

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

Type Suffix
directory /
symlink @
executable *
fifo |
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
Default: true

Enables colorful output.

opt.suffixes

Type: Boolean
Default: true

Enables type suffixes.

opt.groupDirectoriesFirst

Type: Boolean
Default: true

Groups directories before files.

opt.sort

Type: Boolean
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