Commit e0c83b12 authored by Aral Balkan's avatar Aral Balkan
Browse files

Remove fs-extra dependency from JSDB.js

parent 802e0800
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
import fs from 'fs-extra' import fs from 'fs'
import path from 'path' import path from 'path'
import { log } from './Util.js' import { log } from './Util.js'
import asyncForEach from './async-foreach.js' import asyncForEach from './async-foreach.js'
...@@ -74,7 +74,7 @@ export default class JSDB { ...@@ -74,7 +74,7 @@ export default class JSDB {
if (options.deleteIfExists) { if (options.deleteIfExists) {
log(` 💾 ❨JSDB❩ Fresh database requested at ${basePath}; existing database is being deleted.`) log(` 💾 ❨JSDB❩ Fresh database requested at ${basePath}; existing database is being deleted.`)
fs.removeSync(basePath) fs.rmSync(basePath, {recursive: true, force: true})
} }
if (fs.existsSync(basePath)) { if (fs.existsSync(basePath)) {
...@@ -82,7 +82,7 @@ export default class JSDB { ...@@ -82,7 +82,7 @@ export default class JSDB {
this.loadTables() this.loadTables()
} else { } else {
log(` 💾 ❨JSDB❩ No database found at ${basePath}; creating it.`) log(` 💾 ❨JSDB❩ No database found at ${basePath}; creating it.`)
fs.mkdirpSync(basePath) fs.mkdirSync(basePath, {recursive: true})
} }
// NB. we are returning the data proxy, not an // NB. we are returning the data proxy, not an
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment