tr

texas-ranger

An npm module for walking directories.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

2

Maintenance

Last Commit

7yrs ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

0.6KB

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Texas Ranger

This is an npm module for walking directories. Get it?

API

find

Asynchronously finds files in a directory with a given extension.

Parameters:

  • {String} directory - the directory to search
  • {String} extension - the file extension to look for
  • {Boolean} recursive - search sub-directories
  • {Function} callback
    • {Error} err - error encountered or null
    • {String[]} files - an array of the files

Returns: {undefined}

var txRng = require('texas-ranger');

txRng.find('some-dir', 'txt', false, function (err, files) {
    if (!err && files) {
        console.log(files);
    }
});

getExtension

Returns the extension of a given file in lowercase.

Parameters:

  • {String} file

Returns: {String}

var txRng = require('texas-ranger');

txRng.getExtension('foo.bAr'); // 'bar'

isExtension

Test a file to see if it has an extension.

Parameters:

  • {String} file
  • {String} extension

Returns: {Boolean}

var txRng = require('texas-ranger');

txRng.isExtension('foo.bAr', 'BaR'); // true
txRng.isExtension('foo', 'baz'); // false

settings

Settings can be changed to affect how results are returned.

settings.get

Getter for settings value.

Parameters:

  • {String} name

Returns: {String/Boolean/Number}

var txRng = require('texas-ranger');

txRng.settings.get('some-value');

settings.set

Setter for settings value.

Parameters:

  • {String} name
  • {String/Boolean/Number} value

Returns: {undefined}

var txRng = require('texas-ranger');

txRng.settings.set('some-value', 1234);
txRng.settings.get('some-value', 1234); // 1234

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial