@bytebrand/export-cars 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/export-cars",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "bytebrand",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=14.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "3f080de6ddaf9c1df190f330b697824ec73d305f"
|
|
68
68
|
}
|
|
@@ -87,34 +87,20 @@ export class MobileExporter implements Exporter {
|
|
|
87
87
|
|
|
88
88
|
private downloadImages(vehicleId: string, imageUrls: string[]): Promise<PromiseSettledResult<unknown>[]> {
|
|
89
89
|
return Promise.allSettled(
|
|
90
|
-
imageUrls.map((imageUrl, index) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
// );
|
|
105
|
-
// pipeline(data, writer).then(resolve).catch(reject);
|
|
106
|
-
|
|
107
|
-
const imageFile = join(
|
|
108
|
-
this.configService.config.pathesConfig.localConvertedDirectory,
|
|
109
|
-
'images',
|
|
110
|
-
`${vehicleId}_${index + 1}${extname(imageUrl) || '.jpg'}`,
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
await writeFile(imageFile, data, { flag: 'w' });
|
|
114
|
-
resolve(imageFile);
|
|
115
|
-
})
|
|
116
|
-
.catch(reject);
|
|
117
|
-
});
|
|
90
|
+
imageUrls.map(async (imageUrl, index) => {
|
|
91
|
+
const response = await lastValueFrom(
|
|
92
|
+
this.httpService.get(imageUrl, {
|
|
93
|
+
responseType: 'stream',
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
96
|
+
const writer = createWriteStream(
|
|
97
|
+
join(
|
|
98
|
+
this.configService.config.pathesConfig.localConvertedDirectory,
|
|
99
|
+
'images',
|
|
100
|
+
`${vehicleId}_${index + 1}${extname(imageUrl) || '.jpg'}`,
|
|
101
|
+
),
|
|
102
|
+
);
|
|
103
|
+
return pipeline(response.data, writer);
|
|
118
104
|
}),
|
|
119
105
|
);
|
|
120
106
|
}
|