Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

premove

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

premove - npm Package Compare versions

Comparing version 3.0.1 to 4.0.0

7

dist/index.js

@@ -20,7 +20,8 @@ const fs = require('fs');

function premove(dir, opts={}) {
let str = resolve(opts.cwd || '.', dir);
return fs.existsSync(str) && walker(str);
async function premove(dir, opts={}) {
let bool, str = resolve(opts.cwd || '.', dir);
if (bool=fs.existsSync(str)) await walker(str);
return bool;
}
exports.premove = premove;

@@ -1,1 +0,1 @@

export function premove(filepath: string, options?: { cwd?: string }): Promise<void> | false;
export function premove(filepath: string, options?: { cwd?: string }): Promise<boolean>;
{
"name": "premove",
"version": "3.0.1",
"version": "4.0.0",
"repository": "lukeed/premove",
"description": "A tiny (202B to 249B) utility to remove items recursively",
"description": "A tiny (208B to 260B) utility to remove items recursively",
"module": "dist/index.mjs",

@@ -54,5 +54,5 @@ "main": "dist/index.js",

"esm": "3.2.25",
"mk-dirs": "2.1.0",
"uvu": "0.3.3"
"mk-dirs": "3.0.0",
"uvu": "0.5.2"
}
}
# premove [![CI](https://github.com/lukeed/premove/workflows/CI/badge.svg)](https://github.com/lukeed/premove/actions) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/premove)](https://codecov.io/gh/lukeed/premove)
> A tiny (202B to 249B) utility to remove items recursively
> A tiny (208B to 260B) utility to remove items recursively

@@ -54,3 +54,4 @@ This is a `Promise`-based, cross-platform utility that recursively removes files and directories. It's effectively a programmatic `rm -rf` for Node.js. There's also a [CLI](#cli) for easy, cross-platform usage.

premove('./foobar').then(val => {
console.log(val); //=> undefined
console.log(typeof val);
//=> boolean
}).catch(err => {

@@ -67,3 +68,3 @@ //

A `premove` binary is available as of v4.0.0. <br>It accepts an optional `--cwd` value and a list of paths to delete.
A `premove` binary is available as of v3.0.0. <br>It accepts an optional `--cwd` value and a list of paths to delete.

@@ -87,6 +88,5 @@ > **Important:** By default `premove` refuses to delete:

### premove(str, opts={})
Returns: `Promise<undefined>` or `false`
Returns: `Promise<boolean>`
Returns a Promise that resolves to `undefined` once complete.<br>
Returns `false` immediately if the initial filepath (`str`) does not exist.
Returns a Promise that resolves with a boolean value. <br>If `true`, indicates that the `str` input _did exist_ and was successfully removed. A `false` value indicates that the `str` input _did not exist_, meaning nothing needed to be removed.

@@ -115,3 +115,3 @@ > **Important:**<br>The `sync` and `async` versions share the same API.<br>The **only** difference is that `sync` is not Promise-based.

- [totalist](https://github.com/lukeed/totalist) - A tiny (195B to 224B) utility to recursively list all (total) files in a directory
- [mk-dirs](https://github.com/lukeed/mk-dirs) - A tiny (420B) utility to make a directory and its parents, recursively
- [mk-dirs](https://github.com/lukeed/mk-dirs) - A tiny (381B to 419B) utility to make a directory and its parents, recursively
- [escalade](https://github.com/lukeed/escalade) - A tiny (183B) and fast utility to ascend parent directories

@@ -118,0 +118,0 @@

@@ -1,1 +0,1 @@

export function premove(filepath: string, options?: { cwd?: string }): void | false;
export function premove(filepath: string, options?: { cwd?: string }): boolean;

@@ -15,6 +15,7 @@ const fs = require('fs');

function premove(dir, opts={}) {
let str = resolve(opts.cwd || '.', dir);
return fs.existsSync(str) && walker(str);
let bool, str = resolve(opts.cwd || '.', dir);
if (bool=fs.existsSync(str)) walker(str);
return bool;
}
exports.premove = premove;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc