monkeeShark/packages/backend
Johann150 e27c6abaea
refactor: temporary files (#8713)
* simplify temporary files for thumbnails

Because only a single file will be written to the directory, creating a
separate directory seems unnecessary. If only a temporary file is created,
the code from `createTemp` can be reused here as well.

* refactor: deduplicate code for temporary files/directories

To follow the DRY principle, the same code should not be duplicated
across different files. Instead an already existing function is used.

Because temporary directories are also create in multiple locations,
a function for this is also newly added to reduce duplication.

* fix: clean up identicon temp files

The temporary files for identicons are not reused and can be deleted
after they are fully read. This condition is met when the stream is closed
and so the file can be cleaned up using the events API of the stream.

* fix: ensure cleanup is called when download fails

* fix: ensure cleanup is called in error conditions

This covers import/export queue jobs and is mostly just wrapping all
code in a try...finally statement where the finally runs the cleanup.

* fix: use correct type instead of `any`
2022-05-25 16:50:22 +09:00
..
.vscode Update settings.json 2022-04-15 21:33:00 +09:00
assets feat: use instance icon for splash screen 2022-03-09 23:00:28 +09:00
migration hotfix: uniform color migration fix 2022-05-19 15:42:55 +02:00
src refactor: temporary files (#8713) 2022-05-25 16:50:22 +09:00
test lint 2022-05-21 22:21:41 +09:00
.eslintignore use eslint 2021-11-12 10:35:41 +09:00
.eslintrc.cjs test: __dirnameはESModuleでは使えないので置き換えた (#8626) 2022-05-14 16:09:47 +09:00
.mocharc.json Update .mocharc.json 2022-05-21 22:24:57 +09:00
.npmrc refactoring 2021-11-12 02:02:25 +09:00
.yarnrc use eslint 2021-11-12 10:35:41 +09:00
jsconfig.json use eslint 2021-11-12 10:35:41 +09:00
ormconfig.js refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
package.json Supports Unicode Emoji 14.0 (#8699) 2022-05-25 16:35:30 +09:00
tsconfig.json update node to 18 2022-04-23 12:37:44 +09:00
watch.mjs implement dev command 2021-11-19 14:48:59 +09:00
yarn.lock Supports Unicode Emoji 14.0 (#8699) 2022-05-25 16:35:30 +09:00