Socket
Socket
Sign inDemoInstall

kindly

Package Overview
Dependencies
6
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    kindly

A thin wrapper for fs to group files by type


Version published
Weekly downloads
12
decreased by-47.83%
Maintainers
2
Install size
2.07 MB
Created
Weekly downloads
 

Readme

Source

Build Status downloads npm Code Climate Test Coverage dependencies

NPM info

Kindly

Purpose

Kindly is a thin wrapper around fs.readdir that groups files by type.

Installation

npm install kindly --save

var kindly = require('kindly');

API

.get(directory[, options, callback])

Get files in a directory asynchronously. This function returns a promise but also accepts a callback if you prefer a more traditional style of async.

Promise-based:

kindly.get('dir').then(results => {

}, err => {

});

Callback-based:

kindly.get('dir', (err, results) => {

});

.getSync(directory[, options])

Get files in a directory synchronously.

let results = kindly.getSync('dir');

Results

In all cases described above, results will be an object in this form:

{
  files: [],
  directories: [],
  symlinks: [],
  other: []
}

All file and directory names are prefaced with the path you pass to kindly. Thus, if you use something like

var kindly = require('kindly');
var path = require('path');

kindly.get(path.resolve('lib')).then((results) => {

});

all of results will be fully qualified paths.

Options

noFollow

By default, kindly uses fs.stat and fs.statSync which, in the case of symlinks, give the filetype of the real file to which the symlink points (i.e. by default, you will never get symlinks back in your results). If you would prefer to get symlinks back as symlinks instead of files, you can pass { noFollow: true } as the second argument, which will force this library to use fs.lstat and fs.lstatSync instead.

kindly.get('dir', { noFollow: true }).then(results => {

});

kindly.get('dir', { noFollow: true }, results => {

});

let results = kindly.get('dir', { noFollow: true });

Contributing

Please see the contribution guidelines.

Keywords

FAQs

Last updated on 15 Jan 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc