server-esm: Fix some more service imports

This commit is contained in:
Elian Doran
2024-07-18 23:06:08 +03:00
parent c5561530ec
commit bf29b30004
9 changed files with 26 additions and 24 deletions

View File

@@ -137,7 +137,7 @@ function exec<T>(opts: ExecOpts): Promise<T> {
});
}
function getImage(imageUrl: string) {
function getImage(imageUrl: string): Promise<Buffer> {
const proxyConf = syncOptions.getSyncProxy();
const opts: ClientOpts = {
method: 'GET',
@@ -149,7 +149,7 @@ function getImage(imageUrl: string) {
const proxyAgent = getProxyAgent(opts);
const parsedTargetUrl = url.parse(opts.url);
return new Promise((resolve, reject) => {
return new Promise<Buffer>((resolve, reject) => {
try {
const request = client.request({
method: opts.method,
@@ -181,8 +181,7 @@ function getImage(imageUrl: string) {
});
request.end(undefined);
}
catch (e: any) {
} catch (e: any) {
reject(generateError(opts, e.message));
}
});