Skip to content

Releases: yduman/rmby

1.1.1

02 Sep 19:26
Compare
Choose a tag to compare

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

24 Aug 14:33
Compare
Choose a tag to compare

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.
    The byTime part of the API got a small change with the chaining order leading to this breaking change. Now after calling byTime, you need to call olderThan 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

19 Aug 21:35
Compare
Choose a tag to compare

Changed

  • Simplified time difference calculation

Fixed

  • Making proper use of Promise.all

1.0.1

18 Aug 17:00
Compare
Choose a tag to compare

Changed

  • Making use of fs.promises instead of promisify
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

17 Aug 15:06
Compare
Choose a tag to compare

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

15 Aug 21:53
Compare
Choose a tag to compare

Time to bump up to 0.1.0 ✌️

Added

  • byExtension().thatEquals(string)

0.0.3

15 Aug 21:08
Compare
Choose a tag to compare

Added

  • byName().thatStartsWith(string)
  • byName().thatEndsWith(string)
  • byName().thatIncludes(string)

Changed

  • byName().equalTo(string) is now byName().thatEquals(string) to conform the rest of the byName() API

0.0.2

15 Aug 17:20
Compare
Choose a tag to compare

[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");