-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dependabot/npm_and_yarn/lab/webapp/minimis…
…t-and-minimist-and-mkdirp-1.2.8
- Loading branch information
Showing
11 changed files
with
391 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const db = require("./db").db; | ||
|
||
async function deleteFilesFromGridstore(files) { | ||
try { | ||
let filesP = []; | ||
let filesDeleted = 0; | ||
|
||
for (let i = 0; i < files.length; i++) { | ||
let gfs = new db.GridStore(db, files[i]._id, 'w', { | ||
promiseLibrary: Promise | ||
}); | ||
filesP.push(gfs.unlinkAsync().then(() => { | ||
filesDeleted++; | ||
})); | ||
} | ||
|
||
await Promise.all(filesP); | ||
return filesDeleted; | ||
} catch (err) { | ||
console.log(err); | ||
throw err; | ||
} | ||
} | ||
|
||
module.exports = { | ||
deleteFilesFromGridstore | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.