Skip to content

Commit

Permalink
Merge pull request #296 from kevinoid/drop-rimraf
Browse files Browse the repository at this point in the history
Use fs.rm() instead of rimraf
  • Loading branch information
raszi authored Feb 29, 2024
2 parents 9fcf3ce + eafb034 commit 6ed89d5
Show file tree
Hide file tree
Showing 11 changed files with 830 additions and 5,483 deletions.
1,038 changes: 519 additions & 519 deletions docs/global.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ <h3> </h3>
<section>
<article><h1>Tmp</h1>
<p>A simple temporary file and directory creator for <a href="http://nodejs.org/">node.js.</a></p>
<p><a href="https://travis-ci.org/raszi/node-tmp"><img src="https://travis-ci.org/raszi/node-tmp.svg?branch=master" alt="Build Status"></a>
<a href="https://david-dm.org/raszi/node-tmp"><img src="https://david-dm.org/raszi/node-tmp.svg" alt="Dependencies"></a>
<p><a href="https://github.com/raszi/node-tmp/actions/workflows/node.js.yml"><img src="https://img.shields.io/github/actions/workflow/status/raszi/node-tmp/node.js.yml?branch=master" alt="Build Status"></a>
<a href="https://libraries.io/github/raszi/node-tmp"><img src="https://img.shields.io/librariesio/github/raszi/node-tmp" alt="Dependencies"></a>
<a href="https://badge.fury.io/js/tmp"><img src="https://badge.fury.io/js/tmp.svg" alt="npm version"></a>
<a href="https://raszi.github.io/node-tmp/"><img src="https://img.shields.io/badge/API-documented-brightgreen.svg" alt="API documented"></a>
<a href="https://snyk.io/test/npm/tmp"><img src="https://snyk.io/test/npm/tmp/badge.svg" alt="Known Vulnerabilities"></a></p>
Expand Down Expand Up @@ -84,7 +84,7 @@ <h2>An Important Note on Previously Undocumented Breaking Changes</h2>
<h2>An Important Note on Compatibility</h2>
<p>See the <a href="./CHANGELOG.md">CHANGELOG</a> for more information.</p>
<h3>Version 0.2.2</h3>
<p>Since version 0.2.2, all support for node version &lt; 12 has been dropped.</p>
<p>Since version 0.2.2, all support for node version &lt;= 12 has been dropped.</p>
<h3>Version 0.1.0</h3>
<p>Since version 0.1.0, all support for node versions &lt; 0.10.0 has been dropped.</p>
<p>Most importantly, any support for earlier versions of node-tmp was also dropped.</p>
Expand Down Expand Up @@ -338,7 +338,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Fri Aug 26 2022 22:37:40 GMT+0200 (Mitteleuropäische Sommerzeit)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Feb 28 2024 18:30:02 GMT-0700 (Mountain Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
27 changes: 23 additions & 4 deletions docs/tmp.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ <h1 class="page-title">Source: tmp.js</h1>
const path = require('path');
const crypto = require('crypto');
const _c = { fs: fs.constants, os: os.constants };
const rimraf = require('rimraf');

/*
* The working inner variables.
Expand Down Expand Up @@ -71,12 +70,32 @@ <h1 class="page-title">Source: tmp.js</h1>
_removeObjects = [],

// API change in fs.rmdirSync leads to error when passing in a second parameter, e.g. the callback
FN_RMDIR_SYNC = fs.rmdirSync.bind(fs),
FN_RIMRAF_SYNC = rimraf.sync;
FN_RMDIR_SYNC = fs.rmdirSync.bind(fs);

let
_gracefulCleanup = false;

/**
* Recursively remove a directory and its contents.
*
* @param {string} dirPath path of directory to remove
* @param {Function} callback
* @private
*/
function rimraf(dirPath, callback) {
return fs.rm(dirPath, { recursive: true }, callback);
}

/**
* Recursively remove a directory and its contents, synchronously.
*
* @param {string} dirPath path of directory to remove
* @private
*/
function FN_RIMRAF_SYNC(dirPath) {
return fs.rmSync(dirPath, { recursive: true });
}

/**
* Gets a temporary file name.
*
Expand Down Expand Up @@ -807,7 +826,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Fri Aug 26 2022 22:37:40 GMT+0200 (Mitteleuropäische Sommerzeit)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Feb 28 2024 18:30:02 GMT-0700 (Mountain Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
25 changes: 22 additions & 3 deletions lib/tmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const os = require('os');
const path = require('path');
const crypto = require('crypto');
const _c = { fs: fs.constants, os: os.constants };
const rimraf = require('rimraf');

/*
* The working inner variables.
Expand Down Expand Up @@ -43,12 +42,32 @@ const
_removeObjects = [],

// API change in fs.rmdirSync leads to error when passing in a second parameter, e.g. the callback
FN_RMDIR_SYNC = fs.rmdirSync.bind(fs),
FN_RIMRAF_SYNC = rimraf.sync;
FN_RMDIR_SYNC = fs.rmdirSync.bind(fs);

let
_gracefulCleanup = false;

/**
* Recursively remove a directory and its contents.
*
* @param {string} dirPath path of directory to remove
* @param {Function} callback
* @private
*/
function rimraf(dirPath, callback) {
return fs.rm(dirPath, { recursive: true }, callback);
}

/**
* Recursively remove a directory and its contents, synchronously.
*
* @param {string} dirPath path of directory to remove
* @private
*/
function FN_RIMRAF_SYNC(dirPath) {
return fs.rmSync(dirPath, { recursive: true });
}

/**
* Gets a temporary file name.
*
Expand Down
Loading

0 comments on commit 6ed89d5

Please sign in to comment.