0.0.5 • Published 6 months ago

@chriscdn/find-nuke v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@chriscdn/find-nuke

A tool to recursively find and delete files with specified extensions that are older than a given duration.

Installation

To install using npm:

npm install @chriscdn/find-nuke

To install using yarn:

yarn add @chriscdn/find-nuke

Usage

import { findNuke } from "@chriscdn/find-nuke";

const results = await findNuke("./file/path", {
  olderThan: Duration.with({ days: 4 }),
  extensions: [".pdf"],
  dryRun: true,
  deleteEmptyDirectories: true,
  verbose: false,
});

Important: All options are optional. If no options are provided, the function will delete all files, so use with caution.

Options:

  • olderThan (optional): Deletes files older than the specified duration. This feature relies on the @chriscdn/duration package.
  • extensions (optional): Specifies an array of file extensions (including the leading dot) to delete.
  • dryRun (optional): If set to true, lists files that would be deleted without actually deleting them. Defaults to false.
  • deleteEmptyDirectories (optional): If set to true, removes empty directories after file deletions. Does not include the root directory. Defaults to false.
  • verbose (optional): When set to true, additional details about the action are logged to the console. The default value is false.

Running Tests

The tests simulate various use cases with different parameters.

yarn test

License

MIT

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

10 months ago

0.0.2

11 months ago

0.0.1

11 months ago