mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 15:34:59 +01:00
Bugfix: Failed to save image (#1608)
Signed-off-by: Stephan Raab <raab.stephan@googlemail.com>
This commit is contained in:
parent
2175842a8e
commit
778b39b9bd
@ -33,7 +33,7 @@ import {
|
||||
import url from "url";
|
||||
import fs from "fs";
|
||||
import fetch from "node-fetch";
|
||||
import { pipeline } from "stream";
|
||||
import { pipeline } from "stream/promises";
|
||||
import path from "path";
|
||||
|
||||
import { _t } from "./language-helper";
|
||||
@ -165,7 +165,7 @@ function onLinkContextMenu(ev: Event, params: ContextMenuParams, webContents: We
|
||||
const resp = await fetch(url);
|
||||
if (!resp.ok) throw new Error(`unexpected response ${resp.statusText}`);
|
||||
if (!resp.body) throw new Error(`unexpected response has no body ${resp.statusText}`);
|
||||
pipeline(resp.body, fs.createWriteStream(filePath));
|
||||
await pipeline(resp.body, fs.createWriteStream(filePath));
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
Loading…
Reference in New Issue
Block a user