mirror of
https://github.com/misskey-dev/media-proxy.git
synced 2025-08-07 16:53:56 +09:00
パッケージ公開に最適化
This commit is contained in:
@ -1 +1,21 @@
|
||||
import*as tmp from"tmp";export function createTemp(){return new Promise((res,rej)=>{tmp.file((e,path,fd,cleanup)=>{if(e)return rej(e);res([path,process.env.NODE_ENV==="production"?cleanup:()=>{}])})})}export function createTempDir(){return new Promise((res,rej)=>{tmp.dir({unsafeCleanup:true},(e,path,cleanup)=>{if(e)return rej(e);res([path,process.env.NODE_ENV==="production"?cleanup:()=>{}])})})}
|
||||
import * as tmp from 'tmp';
|
||||
export function createTemp() {
|
||||
return new Promise((res, rej) => {
|
||||
tmp.file((e, path, fd, cleanup) => {
|
||||
if (e)
|
||||
return rej(e);
|
||||
res([path, process.env.NODE_ENV === 'production' ? cleanup : () => { }]);
|
||||
});
|
||||
});
|
||||
}
|
||||
export function createTempDir() {
|
||||
return new Promise((res, rej) => {
|
||||
tmp.dir({
|
||||
unsafeCleanup: true,
|
||||
}, (e, path, cleanup) => {
|
||||
if (e)
|
||||
return rej(e);
|
||||
res([path, process.env.NODE_ENV === 'production' ? cleanup : () => { }]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user