{"id":22011514,"url":"https://github.com/lasalefamine/readdir-life","last_synced_at":"2026-05-02T15:40:51.311Z","repository":{"id":57348656,"uuid":"83965891","full_name":"LasaleFamine/readdir-life","owner":"LasaleFamine","description":":file_folder: Check the oldest/latest files/folders within a directory","archived":false,"fork":false,"pushed_at":"2017-03-05T14:21:04.000Z","size":132,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-26T16:04:23.214Z","etag":null,"topics":["directories-scanner","fs","life","readdir","sort","stats"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LasaleFamine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-05T11:46:11.000Z","updated_at":"2017-07-22T21:57:01.000Z","dependencies_parsed_at":"2022-09-02T15:10:57.677Z","dependency_job_id":null,"html_url":"https://github.com/LasaleFamine/readdir-life","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasaleFamine%2Freaddir-life","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasaleFamine%2Freaddir-life/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasaleFamine%2Freaddir-life/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasaleFamine%2Freaddir-life/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LasaleFamine","download_url":"https://codeload.github.com/LasaleFamine/readdir-life/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245072252,"owners_count":20556353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["directories-scanner","fs","life","readdir","sort","stats"],"created_at":"2024-11-30T02:17:12.570Z","updated_at":"2026-05-02T15:40:51.283Z","avatar_url":"https://github.com/LasaleFamine.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# readdir-life\n[![GitHub release](https://img.shields.io/github/release/LasaleFamine/readdir-life.svg?style=flat-square)](https://github.com/LasaleFamine/readdir-life)\n[![Build Status](https://travis-ci.org/LasaleFamine/readdir-life.svg?branch=master\u0026style=flat-square)](https://travis-ci.org/LasaleFamine/readdir-life)\n[![Coverage Status](https://coveralls.io/repos/github/LasaleFamine/readdir-life/badge.svg?branch=master)](https://coveralls.io/github/LasaleFamine/readdir-life?branch=master)\n[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=flat-square)](https://github.com/LasaleFamine/readdir-life)\n[![npm](https://img.shields.io/npm/dt/readdir-life.svg?style=flat-square)](https://github.com/LasaleFamine/readdir-life)\n\n\u003e Check the oldest/latest files/folders within a directory\n\n\n\n## Install\n\n```\n$ yarn add readdir-life\n```\n\n## Usage\n\n```js\nconst {join} = require('path');\nconst readdirLife = require('readdir-life');\n\nconst pathResolved = join(__dirname, 'your-path');\n\nreaddirLife.latest(pathResolved)\n\t.then(res =\u003e console.log(res))\n\t.catch(err =\u003e console.error(err));\n\n/* =\u003e\n\n{\n\tfile: 'latest-file-or-folder-modified',\n\tstat: {\n\t\tdev: 16777220,\n\t\tmode: 33188,\n\t\tnlink: 1,\n\t\tuid: 501,\n\t\tgid: 20,\n\t\trdev: 0,\n\t\tblksize: 4096,\n\t\tino: 14889287,\n\t\tsize: 0,\n\t\tblocks: 0,\n\t\tatime: 2017-03-05T01:29:07.000Z,\n\t\tmtime: 2017-03-05T01:29:16.000Z,\n\t\tctime: 2017-03-05T01:29:16.000Z,\n\t\tbirthtime: 2017-03-05T01:29:06.000Z\n\t}\n}\n*/\n\nreaddirLife.sortLatest(pathResolved)\n\t.then(res =\u003e console.log(res))\n\t.catch(err =\u003e console.error(err));\n\n/* =\u003e\n\n[{\n\tfile: 'latest-file-or-folder-modified',\n\tstat: {\n\t\tdev: 16777220,\n\t\tmode: 33188,\n\t\tnlink: 1,\n\t\tuid: 501,\n\t\tgid: 20,\n\t\trdev: 0,\n\t\tblksize: 4096,\n\t\tino: 14889287,\n\t\tsize: 0,\n\t\tblocks: 0,\n\t\tatime: 2017-03-05T01:29:07.000Z,\n\t\tmtime: 2017-03-05T01:29:16.000Z,\n\t\tctime: 2017-03-05T01:29:16.000Z,\n\t\tbirthtime: 2017-03-05T01:29:06.000Z\n\t}\n}, {...}]\n*/\n```\n\n\n## API\n\n### .latest(input, [options])\n\n#### input\n\nType: `string`\n\nDirectory to read.\n\n#### options\n\n##### typeTime\n\nType: `string`\u003cbr\u003e\nDefault: `mtime` // Modified time\n\nType of the time to check: `ctime|mtime|atime|birthtime`\nMore info: [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats)\n\n### .oldest(input, [options])\n#### return\nType: `object`\n\n#### input\n\nType: `string`\n\nDirectory to read.\n\n#### options\n\n##### typeTime\n\nType: `string`\u003cbr\u003e\nDefault: `mtime` // Modified time\n\nType of the time to check: `ctime|mtime|atime|birthtime`\nMore info: [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats)\n\n### .sortLatest(input, [options])\n\u003e From the latest to the oldest\n#### return\nType: `array`\n\n#### input\n\nType: `string`\n\nDirectory to read.\n\n#### options\n\n##### typeTime\n\nType: `string`\u003cbr\u003e\nDefault: `mtime` // Modified time\n\nType of the time to check: `ctime|mtime|atime|birthtime`\nMore info: [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats)\n\n### .sortOldest(input, [options])\n\u003e From the oldest to the latest\n#### return\nType: `array`\n\n#### input\n\nType: `string`\n\nDirectory to read.\n\n#### options\n\n##### typeTime\n\nType: `string`\u003cbr\u003e\nDefault: `mtime` // Modified time\n\nType of the time to check: `ctime|mtime|atime|birthtime`\nMore info: [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats)\n\n## Related\n- [fs.readdir](https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback)\n- [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats)\n\n## License\n\nMIT © [LasaleFamine](https://godev.space)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flasalefamine%2Freaddir-life","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flasalefamine%2Freaddir-life","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flasalefamine%2Freaddir-life/lists"}