mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 16:13:12 +09:00
Fix open file stream error on some systems
This commit is contained in:
1 file changed
+5
-7
@@ -269,15 +269,13 @@ export default class ModStore extends TypedEventEmitter<keyof ModStoreEvents, Mo
|
|||||||
throw new Error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
|
throw new Error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileStream = fs.createWriteStream(filePath);
|
if (!response.body) {
|
||||||
|
|
||||||
// Check if the response body exists and pipe it to the file
|
|
||||||
if (response.body) {
|
|
||||||
const writer = Writable.toWeb(fileStream);
|
|
||||||
await response.body.pipeTo(writer);
|
|
||||||
} else {
|
|
||||||
throw new Error("Response body is missing.");
|
throw new Error("Response body is missing.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fileStream = fs.createWriteStream(filePath);
|
||||||
|
const writer = Writable.toWeb(fileStream);
|
||||||
|
await response.body.pipeTo(writer);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error("Error downloading file:", error);
|
logger.error("Error downloading file:", error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Reference in new issue
Block a user