Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require('fs');
- const express = require('express');
- const app = express();
- const { promisify } = require('util');
- const unlink = promisify(fs.unlink);
- app.delete('/delete', (req, res) => {
- try {
- await Promise.all([unlink('path/doc_1'), unlink('path/doc_2')]);
- res.end();
- } catch(e) {
- console.error(e);
- res.status(500).send('Ocorreu um erro interno.');
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement