@bytebrand/export-cars 1.0.12 → 1.0.14
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.14",
|
|
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": "096d9d9ff57b54b5fe3ac91597e463cd657f1a69"
|
|
68
68
|
}
|
|
@@ -87,34 +87,19 @@ 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
|
-
// 'images',
|
|
102
|
-
// `${vehicleId}_${index + 1}${extname(imageUrl) || '.jpg'}`,
|
|
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
|
-
);
|
|
90
|
+
imageUrls.map(async (imageUrl, index) => {
|
|
91
|
+
const response = await lastValueFrom(
|
|
92
|
+
this.httpService.get(imageUrl, {
|
|
93
|
+
responseType: 'arraybuffer',
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
96
|
+
const imageFile = join(
|
|
97
|
+
this.configService.config.pathesConfig.localConvertedDirectory,
|
|
98
|
+
'images',
|
|
99
|
+
`${vehicleId}_${index + 1}${extname(imageUrl) || '.jpg'}`,
|
|
100
|
+
);
|
|
112
101
|
|
|
113
|
-
|
|
114
|
-
resolve(imageFile);
|
|
115
|
-
})
|
|
116
|
-
.catch(reject);
|
|
117
|
-
});
|
|
102
|
+
return writeFile(imageFile, response.data, { flag: 'w' });
|
|
118
103
|
}),
|
|
119
104
|
);
|
|
120
105
|
}
|
package/src/main.ts
CHANGED
|
@@ -3,12 +3,6 @@ import { CommandFactory } from 'nest-commander';
|
|
|
3
3
|
import { AppModule } from './app.module';
|
|
4
4
|
|
|
5
5
|
async function bootstrap() {
|
|
6
|
-
// setInterval(() => {
|
|
7
|
-
// Object.entries(process.memoryUsage()).forEach(item =>
|
|
8
|
-
// console.log(`${item[0]}: ${(item[1] / 1024 / 1024).toFixed(4)} MB`),
|
|
9
|
-
// );
|
|
10
|
-
// console.log('\n');
|
|
11
|
-
// }, 10000);
|
|
12
6
|
try {
|
|
13
7
|
await CommandFactory.run(AppModule, console);
|
|
14
8
|
LoggerService.complete();
|