diff options
Diffstat (limited to 'src/files.ts')
| -rw-r--r-- | src/files.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/files.ts b/src/files.ts index 92ed165..1b8a652 100644 --- a/src/files.ts +++ b/src/files.ts @@ -60,7 +60,11 @@ export const saveFile: (filename: string, projectname: string, fileId: string, o // open streams to append to file let rStream = fs.createReadStream(`${CONTENT_BASE_DIRECTORY}/temp-${filename}`); let wStream = fs.createWriteStream(`${CONTENT_BASE_DIRECTORY}/${projectname}/${fileId}`, {'flags':'a'}); - rStream.pipe(wStream); + rStream.pipe(wStream).on('finish', () => { + fs.removeSync(`${CONTENT_BASE_DIRECTORY}/temp-${filename}`); + }).on('error', (err: any) => { + logger.debug(`Error while saving file to proper location: ${err}`); + }); } export const deleteFile: (fileId: string, projectName: string) => void = |
