1
I am trying to remove two aquivos from my server with the following code:
const fs = require('fs');
const express = require('express');
const app = express();
app.delete('/delete', function(req, res){
fs.unlink('path/doc_1', function(){
fs.unlink('path/doc_2', function(){
res.end();
})
})
})
But the following error is thrown:
UnhandledPromiseRejectionWarning: Error: EBUSY: resource busy or locked, unlink
Someone’s been through it?
The file is not open anywhere?
– Sorack
It is not, I saved it to the server with multer, and use this path to remove it
– Guilherme
Change your file to this here and report the full stacktrace pf: https://pastebin.com/knbxWyUN
– Sorack
In the example I gave you now you have missed the word
async
before the(req, res)
– Sorack
Man, it worked perfectly. Thank you!
– Guilherme