get all json entries in a folder

pull/146/head
Abdullah Alfaraj 2023-03-10 14:21:30 +03:00
parent 7dcef99c50
commit 399225a12b
1 changed files with 16 additions and 0 deletions

View File

@ -659,6 +659,22 @@ class IOJson {
)
return settings_json
}
static async getJsonEntries(doc_entry) {
let entries = await doc_entry.getEntries()
const json_entries = entries.filter(
(e) => e.isFile && e.name.toLowerCase().includes('.json') // must be a file and has the of the type .json
)
console.log('json_entries: ', json_entries)
// .forEach((e) => console.log(e.name))
return json_entries
}
static async deleteFile(doc_entry, file_name) {
try {
const file_entry = await doc_entry.getEntry(file_name)
file_entry.delete()
} catch (e) {}
}
}
module.exports = {