remove-file-safe
Remove files without try catch
Last updated 2 years ago by bconnorwhite .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install remove-file-safe 
SYNC missed versions from official npm registry.

remove-file-safe

NPM TypeScript Coverage Status

Remove files without try catch.

If I should maintain this repo, please ⭐️ GitHub stars

DM me on Twitter if you have questions or suggestions. Twitter


Remove files without try catch.

  • Returns true if file no longer exists.
  • Returns false if unable to remove file.
  • Returns undefined on other errors (ex: permission denied) rather than throwing.

Unless the unsafe flag is set, only files inside the current working directory or OS temp directory will be removed.

Installation

yarn add remove-file-safe
npm install remove-file-safe
pnpm add remove-file-safe

Usage

import { removeFile, removeFileSync, Options } from "remove-file-safe";

function removeFile(path: string, options?: Options): Promise<boolean | undefined>;

function removeFileSync(path: string, options?: Options): boolean | undefined;

type Options = {
  /**
   * Allow removals outside of current working directory, or OS temp directory. Default: `false`
   */
  unsafe?: boolean;
};

Dependenciesdependencies


Dev Dependencies

  • @types/mock-fs: TypeScript definitions for mock-fs
  • @types/node: TypeScript definitions for Node.js
  • autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.
  • mock-fs: A configurable mock file system. You know, for testing.

License license

MIT


Related Packages

Current Tags

  • 3.0.0                                ...           latest (2 years ago)

4 Versions

  • 3.0.0                                ...           2 years ago
  • 2.0.0                                ...           3 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |