Releases: yduman/rmby
Releases · yduman/rmby
1.1.1
Changed
- Updated development libraries that are now compatible with version 4 of TypeScript
- Previously, when executing
run()
it would throw an error if the filter couldn't find anything. This feels wrong, because it can be totally fine if the filter doesn't find anything. Now the function will return an empty array if the filter could not find any results.
Fixed
- Tests for filters that don't find matches
Removed
- Tests for cases when
fs
functions fail for some reason. These tests were kind of useless and now obsolete since in case of failure we don't delete anything and just return an empty array.
1.1.0
Added
- When your filter criteria does not match with any files it will throw an error and notify you
Changed
- The API got refactored from classes to functions. The library now just exposes the function
remove
which can be invoked for chaining.
ThebyTime
part of the API got a small change with the chaining order leading to this breaking change. Now after callingbyTime
, you need to callolderThan
and than you can specify your desired time unit.
- new RemoveFiles().from("/some/path").byTime().inHours().olderThan(12).run()
+ remove().from("/some/path").byTime().olderThan(12).hours().run()
Fixed
- Fixed a bug where the combination of filters would produce an incorrect filter result
Removed
- Classes from the old API
1.0.2
1.0.1
Changed
- Making use of
fs.promises
instead ofpromisify
import fs from "fs";
- import { promisify } from "util";
- export const readdir = promisify(fs.readdir);
+ export const readdir = fs.promises.readdir;
- export const stat = promisify(fs.stat);
+ export const stat = fs.promises.stat;
- export const unlink = promisify(fs.unlink);
+ export const unlink = fs.promises.unlink;
1.0.0
Added
- New and more fine granular API that is composable (see examples below)
- Chain of Responsibility Pattern for dealing with filter criteria's
run()
needs to be called at the end of the chain in order to execute removal
import { RemoveFile } from "rmby";
// Remove By Time
new RemoveFile().from("/some/dir").byTime().inMilliseconds().olderThan(1200).run();
new RemoveFile().from("/some/dir").byTime().inSeconds().olderThan(90).run();
new RemoveFile().from("/some/dir").byTime().inMinutes().olderThan(150).run();
new RemoveFile().from("/some/dir").byTime().inHours().olderThan(18).run();
// Remove By Name
new RemoveFile().from("/some/dir").byName().thatEqualsTo("index").run();
new RemoveFile().from("/some/dir").byName().thatStartsWith("ind").run();
new RemoveFile().from("/some/dir").byName().thatEndsWith("dex").run();
new RemoveFile().from("/some/dir").byName().thatIncludes("nde").run();
// Remove By Extension
new RemoveFile().from("/some/dir").byExtension(".js");
// Remove By Combination
new RemoveFiles()
.from("/some/dir")
.byName()
.thatStartsWith("ind")
.and()
.byExtension(".js")
.and()
.byTime()
.inMinutes()
.olderThan(15)
.run();
Changed
- Re-organized tests for more modularity
Fixed
--
Removed
- Replaced/Removed API state of
0.1.0
0.1.0
0.0.3
0.0.2
[email protected]
- This is the initial release, since I forgot to make one while being at 0.0.1 😅.
- This version has 100% code coverage and provides currently the following API:
import { Remove } from "rmby";
const remove = new Remove("/path/to/dir");
// Remove by time aspect
remove.byMilliseconds().olderThan(1200);
remove.bySeconds().olderThan(30);
remove.byMinutes().olderThan(15);
remove.byHours().olderThan(8);
// Remove by name aspect
remove.byName().equalTo("filename");