0.1.1 • Published 8 years ago

recently-modified-files v0.1.1

Weekly downloads
50
License
MIT
Repository
github
Last release
8 years ago

recently-modified-files

NPM version Build Status Codecov Status Standard

Gets a list of recently modified files in a dir

Install

npm install --save recently-modified-files

Usage

import rmf from 'recently-modified-files'

rmf(dir, fn)

params

  • dir {string} The dir to test for files
  • fn {Function} Callback, the arguments are
    • err {Error} Possible exception or null
    • files {Array} An array with the names of the files where the first one is the most recently modified file or an empty array when there are no files

const filenames = rmf.sync(dir)

params

  • dir {string} The path to test for files

return

An array of strings with the filenames on path in descending order with respect to the modified time

rmf.promise(dir)

params

  • dir {string} The path to test for files

return

A native promise, note that it's required that global.Promise is defined

NOTE: the test to check if a file is a file is by calling stat.isFile() which means that folders/symlinks are ignored

License

MIT © 2016 Mauricio Poppe