mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
inline function immediately called lolwtf
This commit is contained in:
@@ -5273,7 +5273,6 @@ app.post('/asset_download', jsonParser, async (request, response) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Download to temp
|
// Download to temp
|
||||||
const downloadFile = (async (url, temp_path) => {
|
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error(`Unexpected response ${res.statusText}`);
|
throw new Error(`Unexpected response ${res.statusText}`);
|
||||||
@@ -5287,9 +5286,6 @@ app.post('/asset_download', jsonParser, async (request, response) => {
|
|||||||
}
|
}
|
||||||
const fileStream = fs.createWriteStream(destination, { flags: 'wx' });
|
const fileStream = fs.createWriteStream(destination, { flags: 'wx' });
|
||||||
await finished(Readable.fromWeb(res.body).pipe(fileStream));
|
await finished(Readable.fromWeb(res.body).pipe(fileStream));
|
||||||
});
|
|
||||||
|
|
||||||
await downloadFile(url, temp_path);
|
|
||||||
|
|
||||||
// Move into asset place
|
// Move into asset place
|
||||||
console.debug("Download finished, moving file from", temp_path, "to", file_path);
|
console.debug("Download finished, moving file from", temp_path, "to", file_path);
|
||||||
|
Reference in New Issue
Block a user