Spaces:
Paused
Paused
Download node_modules/fs-extra/lib/empty/index.js from no1b4me/hytranslator: direct link, hf CLI and curl.
- Browser
- Download file 747 Bytes
-
https://huggingface.co/spaces/no1b4me/hytranslator/resolve/main/node_modules/fs-extra/lib/empty/index.js
- Command line
-
hf download hf://spaces/no1b4me/hytranslator/node_modules/fs-extra/lib/empty/index.js
-
curl -L -o index.js https://huggingface.co/spaces/no1b4me/hytranslator/resolve/main/node_modules/fs-extra/lib/empty/index.js
747 Bytes
| const u = require('universalify').fromPromise | |
| const fs = require('../fs') | |
| const path = require('path') | |
| const mkdir = require('../mkdirs') | |
| const remove = require('../remove') | |
| const emptyDir = u(async function emptyDir (dir) { | |
| let items | |
| try { | |
| items = await fs.readdir(dir) | |
| } catch { | |
| return mkdir.mkdirs(dir) | |
| } | |
| return Promise.all(items.map(item => remove.remove(path.join(dir, item)))) | |
| }) | |
| function emptyDirSync (dir) { | |
| let items | |
| try { | |
| items = fs.readdirSync(dir) | |
| } catch { | |
| return mkdir.mkdirsSync(dir) | |
| } | |
| items.forEach(item => { | |
| item = path.join(dir, item) | |
| remove.removeSync(item) | |
| }) | |
| } | |
| module.exports = { | |
| emptyDirSync, | |
| emptydirSync: emptyDirSync, | |
| emptyDir, | |
| emptydir: emptyDir | |
| } | |