Open gclego opened 2 months ago
And the same node script can delete the files (without any user/owner / rights modification) if the node js process has been restarted?
yes. if I just delete the files, it works fine.
you need to do that in the done callback:
const Recipe = require('muhammara').Recipe;
const fs = require('fs');
const pdfDoc = new Recipe('test1.pdf', 'result.pdf');
const pdf2 = 'test2.pdf';
pdfDoc.appendPage(pdf2).endPDF(() => {
fs.unlinkSync('test1.pdf');
fs.unlinkSync('test2.pdf');
});
// error here: Error: EBUSY: resource busy or locked, unlink
still the same error :(
I wrote a Test which does exactly this. No issues there. Did you move the delete, for Testing purposes, to the first lines and return? So basically remove the recipe Code and then it works?
There is either some Race condition or you have that file Open somwewhere else.
Please also test if a setTimeout and unlink files later works. This might inidicate some Timing issues.
If I comment the Recipe code and just delete the files, it works. But when I put back the code, I'm getting the error. Also setTimeout does not work and the file is still locked. So I'm guessing something within the Recipe is not freeing up the files.
please provide your os, arch and node version
windows x64 node 20.12.2
Hi, first of all thank you for maintaining this project. Its awesome.
I just encountered an issue where I will merge two pdfs, then delete the files after wards. However I'm unable to delete the files and get an error EBUSY: resource busy or locked. Workaround is not to use Recipe, but would be great if this is fixed. Please see code below: