I have a script where I am potentially producing multiple files, but want them to be contained in a single folder on output.
Once I have ascertained that I will be producing multiple files, I try to create a new job based on a temporary folder as such:
Code: Select all
// If multiple files are possible, then make a folder to keep the files in for output.
if (multipleFiles) {
const tmpFolder = await tmp.dir({ unsafeCleanup: true });
const newJobFolder = await job.createChild(tmpFolder.path);
}
If change tmp.dir to tmp.file, I do not get the error, but obviously that doesn't help me with my requirements.
I have tried running in debug, creating a breakpoint on the tmpFolder line and can confirm that the folder is definitely being created.
Looking at the documentation here I can see that I should be able to supply a file or folder, but the latter just does not seem to work.
Can anyone please give me some advice?
Many thanks.