{"id":24493387,"url":"https://github.com/yduman/rmby","last_synced_at":"2026-04-11T21:45:09.648Z","repository":{"id":143906562,"uuid":"287115407","full_name":"yduman/rmby","owner":"yduman","description":"A zero-dependency Node.js library with a fluent API for asynchronous file removal by chaining filters","archived":false,"fork":false,"pushed_at":"2021-05-01T16:31:26.000Z","size":482,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T03:03:21.302Z","etag":null,"topics":["filesystem","filter","fluent-api","fluent-interface","fs","javascript","jest","nodejs","remove-files","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/yduman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-08-12T21:06:03.000Z","updated_at":"2023-03-10T08:32:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"939766c6-c738-4165-851d-438321646c27","html_url":"https://github.com/yduman/rmby","commit_stats":{"total_commits":74,"total_committers":2,"mean_commits":37.0,"dds":0.2432432432432432,"last_synced_commit":"e7498e326310d82e6d234e245e77e16caea39890"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yduman%2Frmby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yduman%2Frmby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yduman%2Frmby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yduman%2Frmby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yduman","download_url":"https://codeload.github.com/yduman/rmby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243681002,"owners_count":20330155,"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":["filesystem","filter","fluent-api","fluent-interface","fs","javascript","jest","nodejs","remove-files","typescript"],"created_at":"2025-01-21T19:39:47.690Z","updated_at":"2026-04-11T21:45:04.616Z","avatar_url":"https://github.com/yduman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rmby\n\n![npm](https://img.shields.io/npm/v/rmby)\n[![Build Status](https://travis-ci.org/yduman/rmby.svg?branch=master)](https://travis-ci.org/yduman/rmby)\n[![codecov](https://codecov.io/gh/yduman/rmby/branch/master/graph/badge.svg)](https://codecov.io/gh/yduman/rmby)\n![NPM](https://img.shields.io/npm/l/rmby)\n\nrmby (\"remove by\") is a zero-dependency Node.js library with a fluent interface for removing files asynchronously by certain aspects.\n\n## Installation\n\nNode.js v12 or higher is required\n\n```console\n$ npm i --save rmby\n$ yarn add rmby\n```\n\n## Usage\n\nThe `remove` function is all you need. You can navigate yourself through the API by chaining functions, since the API provides a [fluent interface](https://martinfowler.com/bliki/FluentInterface.html). On the [API section](#api) you can see more details about the usage.\n\n```js\n// JavaScript\nconst { remove } = require(\"rmby\");\n\n// TypeScript\nimport { remove } from \"rmby\";\n```\n\n## API\n\nIn order to run your remove query, you have to call the `run()` method at the end of your function chain. This function will remove all files that match with your filter criteria and will return a `Promise\u003cstring[]\u003e` containing every file path that has been removed. If your filter cannot find matches, it will just return an empty array and do nothing.\n\n### Remove Files By Time\n\nFiles can be removed by a time difference in milliseconds, seconds, minutes or hours. The time difference is always checked against the current time.\n\n```js\n// Remove all files that are older than 12 hours\nremove().from(\"/some/path/to/dir\").byTime().olderThan(12).hours().run();\n```\n\n### Remove Files By Name\n\nFiles can be removed regarding its name without considering the file extension. You can remove files that match exactly, start with, end with, or include the name that you provide.\n\n```js\n// Remove all files that start with \"React\"\nremove().from(\"/some/path/to/dir\").byName().thatStartsWith(\"React\").run();\n```\n\n### Remove Files By Extension\n\nFiles can be removed regarding their file extension. You can remove files that match exactly with the file extension you provide.\n\n```js\n// Remove all .log files\nremove().from(\"/some/path/to/dir\").byExtension(\".log\").run();\n```\n\n### Remove Files By Combination\n\nFiles can be removed by combining the available filters. Therefore you can create more specific filters for your use case.\n\n```js\n// Remove all log files that start with \"app\" and are older than 12 hours\nremove()\n  .from(\"/some/path/to/dir\")\n  .byName()\n  .thatStartsWith(\"app\")\n  .and()\n  .byExtension(\".log\")\n  .and()\n  .byTime()\n  .olderThan(12)\n  .hours()\n  .run();\n```\n\n## Development\n\nrmby is developed with [TypeScript](https://www.typescriptlang.org/). The `master` branch is used for development. Stable releases are always tagged with the latest version.\n\n## Testing\n\nrmby is using [Jest](https://jestjs.io/) as a JavaScript Testing Framework. For testing, run `npm test`. For code coverage, run `npm run test:cov`. We have currently 100% code coverage and aim to stick with it.\n\n## Philosophy\n\nThe philosophy is to provide an easy to use library for file removal in Node.js, without dependencies and with a very declarative API. The fluent interface should guide the user through its use case.\n\n## People\n\nrmby is currently maintained by [Yadullah Duman](https://github.com/yduman)\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyduman%2Frmby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyduman%2Frmby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyduman%2Frmby/lists"}