@nka212bg/backend-utils 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +1 -0
  2. package/misc.js +6 -6
  3. package/package.json +2 -8
package/index.js ADDED
@@ -0,0 +1 @@
1
+ // init the lib
package/misc.js CHANGED
@@ -212,7 +212,7 @@ exports.saveImage = ({ file, writePath, width, height, loop = 0, quality = 85, m
212
212
  };
213
213
 
214
214
  // Delete files or dirs recursive
215
- exports.deleteFolder = (path, pathTemp) => {
215
+ exports.deleteRecursive = (path, pathTemp) => {
216
216
  if (existsSync(path)) {
217
217
  if (lstatSync(path).isDirectory()) {
218
218
  var files = readdirSync(path);
@@ -227,18 +227,18 @@ exports.deleteFolder = (path, pathTemp) => {
227
227
  if (lstatSync(currentPath).isDirectory() && !readdirSync(currentPath).length) {
228
228
  rmdirSync(currentPath);
229
229
  } else {
230
- this.deleteFolder(path + "/" + files[file], path);
230
+ this.deleteRecursive(path + "/" + files[file], path);
231
231
  }
232
232
  }
233
- this.deleteFolder(path);
233
+ this.deleteRecursive(path);
234
234
  } else {
235
235
  unlinkSync(path);
236
236
  }
237
237
  }
238
- if (pathTemp) this.deleteFolder(pathTemp);
238
+ if (pathTemp) this.deleteRecursive(pathTemp);
239
239
  };
240
240
 
241
- exports.copyFolder = (source, destination) => {
241
+ exports.copyRecursive = (source, destination) => {
242
242
  if (!existsSync(destination)) mkdirSync(destination, { recursive: true });
243
243
 
244
244
  readdirSync(source).forEach((item) => {
@@ -246,7 +246,7 @@ exports.copyFolder = (source, destination) => {
246
246
  const destinationPath = `${destination}/${item}`;
247
247
 
248
248
  if (lstatSync(sourcePath).isDirectory()) {
249
- this.copyFolder(sourcePath, destinationPath);
249
+ this.copyRecursive(sourcePath, destinationPath);
250
250
  } else {
251
251
  copyFileSync(sourcePath, destinationPath);
252
252
  }
package/package.json CHANGED
@@ -1,14 +1,8 @@
1
1
  {
2
2
  "name": "@nka212bg/backend-utils",
3
3
  "author": "nka212bg",
4
- "version": "0.1.1",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://gitlab.com/nka212bg/npm-backend.git"
8
- },
9
- "keywords": [
10
- "misc"
11
- ],
4
+ "version": "0.1.3",
5
+ "main": "index.js",
12
6
  "dependencies": {
13
7
  "@maxmind/geoip2-node": "^5.0.0",
14
8
  "systeminformation": "^5.21.24",