mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-10 18:43:10 +02:00
8b46edeccf
* fix(server): /emoji to accept `@.` host expression
* fix(client): use MkEmoji for custom emoji in MkEmojiPicker
* change convertToWebp
* nanka iroiro
* remove
* fix
* nearLosslessは労多くして益少なしなのでやめる
* do not cleanup tmp for development
* update sharp.js to 0.31.3
* mixed: true
* fix MkAutocomplete of 912791b3ab
* clean up
* https://github.com/misskey-dev/misskey/pull/9431#discussion_r1059215943
24 lines
621 B
TypeScript
24 lines
621 B
TypeScript
import * as tmp from 'tmp';
|
|
|
|
export function createTemp(): Promise<[string, () => void]> {
|
|
return new Promise<[string, () => void]>((res, rej) => {
|
|
tmp.file((e, path, fd, cleanup) => {
|
|
if (e) return rej(e);
|
|
res([path, process.env.NODE_ENV === 'production' ? cleanup : () => {}]);
|
|
});
|
|
});
|
|
}
|
|
|
|
export function createTempDir(): Promise<[string, () => void]> {
|
|
return new Promise<[string, () => void]>((res, rej) => {
|
|
tmp.dir(
|
|
{
|
|
unsafeCleanup: true,
|
|
},
|
|
(e, path, cleanup) => {
|
|
if (e) return rej(e);
|
|
res([path, process.env.NODE_ENV === 'production' ? cleanup : () => {}]);
|
|
},
|
|
);
|
|
});
|
|
}
|