Skip to content

Commit 6ed89d5

Browse files
authored
Merge pull request #296 from kevinoid/drop-rimraf
Use fs.rm() instead of rimraf
2 parents 9fcf3ce + eafb034 commit 6ed89d5

11 files changed

+830
-5483
lines changed

docs/global.html

+519-519
Large diffs are not rendered by default.

docs/index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ <h3> </h3>
4545
<section>
4646
<article><h1>Tmp</h1>
4747
<p>A simple temporary file and directory creator for <a href="http://nodejs.org/">node.js.</a></p>
48-
<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>
49-
<a href="https://david-dm.org/raszi/node-tmp"><img src="https://david-dm.org/raszi/node-tmp.svg" alt="Dependencies"></a>
48+
<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>
49+
<a href="https://libraries.io/github/raszi/node-tmp"><img src="https://img.shields.io/librariesio/github/raszi/node-tmp" alt="Dependencies"></a>
5050
<a href="https://badge.fury.io/js/tmp"><img src="https://badge.fury.io/js/tmp.svg" alt="npm version"></a>
5151
<a href="https://raszi.github.io/node-tmp/"><img src="https://img.shields.io/badge/API-documented-brightgreen.svg" alt="API documented"></a>
5252
<a href="https://snyk.io/test/npm/tmp"><img src="https://snyk.io/test/npm/tmp/badge.svg" alt="Known Vulnerabilities"></a></p>
@@ -84,7 +84,7 @@ <h2>An Important Note on Previously Undocumented Breaking Changes</h2>
8484
<h2>An Important Note on Compatibility</h2>
8585
<p>See the <a href="./CHANGELOG.md">CHANGELOG</a> for more information.</p>
8686
<h3>Version 0.2.2</h3>
87-
<p>Since version 0.2.2, all support for node version &lt; 12 has been dropped.</p>
87+
<p>Since version 0.2.2, all support for node version &lt;= 12 has been dropped.</p>
8888
<h3>Version 0.1.0</h3>
8989
<p>Since version 0.1.0, all support for node versions &lt; 0.10.0 has been dropped.</p>
9090
<p>Most importantly, any support for earlier versions of node-tmp was also dropped.</p>
@@ -338,7 +338,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
338338
<br class="clear">
339339

340340
<footer>
341-
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)
341+
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)
342342
</footer>
343343

344344
<script> prettyPrint(); </script>

docs/tmp.js.html

+23-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ <h1 class="page-title">Source: tmp.js</h1>
4242
const path = require('path');
4343
const crypto = require('crypto');
4444
const _c = { fs: fs.constants, os: os.constants };
45-
const rimraf = require('rimraf');
4645

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

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

7775
let
7876
_gracefulCleanup = false;
7977

78+
/**
79+
* Recursively remove a directory and its contents.
80+
*
81+
* @param {string} dirPath path of directory to remove
82+
* @param {Function} callback
83+
* @private
84+
*/
85+
function rimraf(dirPath, callback) {
86+
return fs.rm(dirPath, { recursive: true }, callback);
87+
}
88+
89+
/**
90+
* Recursively remove a directory and its contents, synchronously.
91+
*
92+
* @param {string} dirPath path of directory to remove
93+
* @private
94+
*/
95+
function FN_RIMRAF_SYNC(dirPath) {
96+
return fs.rmSync(dirPath, { recursive: true });
97+
}
98+
8099
/**
81100
* Gets a temporary file name.
82101
*
@@ -807,7 +826,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
807826
<br class="clear">
808827

809828
<footer>
810-
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)
829+
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)
811830
</footer>
812831

813832
<script> prettyPrint(); </script>

lib/tmp.js

+22-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const os = require('os');
1414
const path = require('path');
1515
const crypto = require('crypto');
1616
const _c = { fs: fs.constants, os: os.constants };
17-
const rimraf = require('rimraf');
1817

1918
/*
2019
* The working inner variables.
@@ -43,12 +42,32 @@ const
4342
_removeObjects = [],
4443

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

4947
let
5048
_gracefulCleanup = false;
5149

50+
/**
51+
* Recursively remove a directory and its contents.
52+
*
53+
* @param {string} dirPath path of directory to remove
54+
* @param {Function} callback
55+
* @private
56+
*/
57+
function rimraf(dirPath, callback) {
58+
return fs.rm(dirPath, { recursive: true }, callback);
59+
}
60+
61+
/**
62+
* Recursively remove a directory and its contents, synchronously.
63+
*
64+
* @param {string} dirPath path of directory to remove
65+
* @private
66+
*/
67+
function FN_RIMRAF_SYNC(dirPath) {
68+
return fs.rmSync(dirPath, { recursive: true });
69+
}
70+
5271
/**
5372
* Gets a temporary file name.
5473
*

0 commit comments

Comments
 (0)