read-all-up

1.0.1 • Public • Published

read-all-up

Read all matching files or directories by walking up parent directories

Install

yarn add read-all-up

Example

const readAllUp = require('read-all-up');
 
readAllUp('package.json', files => {
  console.log(files);
  // [{
  //   filePath: '/nested/current-dir/package.json',
  //   fileContents: Buffer | string,
  // }, {
  //   filePath: '/nested/package.json',
  //   fileContents: Buffer | string,
  // }, {
  //   filePath: '/package.json',
  //   fileContents: Buffer | string,
  // }]
});

API

readAllUp(filename | filename[], [options])

Returns a Promise for the files.

readAllUp.sync(filename | filename[], [options])

Returns files.

filename

Type: string

Filename of the file to find.

options

cwd

Type: string Default: process.cwd()

Directory to start from.

encoding

Type: string

Encoding to read the files as.

Package Sidebar

Install

npm i read-all-up

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

4.64 kB

Total Files

4

Last publish

Collaborators

  • thejameskyle