Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
A tiny (201B to 247B) utility to remove items recursively
This is a Promise
-based utility that recursively removes files and directories. It's effectively rm -rf
for Node.js.
Notice: Node v12.10.0 includes the
recursive
option forfs.rmdir
andfs.rmdirSync
.
$ npm install --save premove
There are two "versions" of premove
available:
Node.js: >= 8.x
Size (gzip): 247 bytes
Availability: CommonJS, ES Module
This is the primary/default mode. It makes use of async
/await
and util.promisify
.
Node.js: >= 6.x
Size (gzip): 201 bytes
Availability: CommonJS, ES Module
This is the opt-in mode, ideal for scenarios where async
usage cannot be supported.
In order to use it, simply make the following changes:
-import premove from 'premove';
+import premove from 'premove/sync';
import premove from 'premove';
import { resolve } from 'path';
// Async/await
try {
await premove('./foobar');
} catch (err) {
//
}
// Promise
premove('./foobar').then(val => {
console.log(val); //=> undefined
}).catch(err => {
//
});
// Using `cwd` option
const dir = resolve('./foo/bar');
await premove('hello.txt', { cwd: dir });
Returns: Promise<undefined>
or false
Returns a Promise that resolves to undefined
once complete.
Returns false
immediately if the initial filepath (str
) does not exist.
Important:
Thesync
andasync
versions share the same API.
The only difference is thatsync
is not Promise-based.
Type: String
The filepath to remove – may be a file or a directory.
An initial existence check is made for this filepath.
Important: This value is resolved to a full path.
Please be aware of how and from where the Node.js file system is resolving your path!
Type: String
Default: .
The directory to resolve your str
from.
Defaults to the process.cwd()
– aka, the directory that your command is run within.
MIT © Luke Edwards
FAQs
A tiny (208B to 260B) utility to remove items recursively
The npm package premove receives a total of 4,079 weekly downloads. As such, premove popularity was classified as popular.
We found that premove demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.