steamutils 1.3.75 → 1.3.77

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.
Files changed (3) hide show
  1. package/SteamClient.js +2426 -2418
  2. package/index.js +14 -4
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -4334,8 +4334,15 @@ export default class SteamUser {
4334
4334
  if (result instanceof ResponseError) {
4335
4335
  return result;
4336
4336
  }
4337
- const $ = cheerio.load(result?.data || "");
4337
+ if (!result?.data || typeof result.data !== "string") {
4338
+ return null;
4339
+ }
4340
+ const $ = cheerio.load(result.data);
4338
4341
  const $table = $("table.generic_kv_table");
4342
+ if (!$table.length) {
4343
+ return null;
4344
+ }
4345
+
4339
4346
  let cooldown_table = table2json($, getTableHasHeaders($, $table, ["Competitive Cooldown Expiration"]));
4340
4347
  let matchmaking_detail_table = table2json($, getTableHasHeaders($, $table, ["Matchmaking Mode", "Wins", "Skill Group"]));
4341
4348
  let matchmaking_table = getTableHasHeaders($, $table, ["Matchmaking Mode", "Last Match"])
@@ -5809,11 +5816,12 @@ export default class SteamUser {
5809
5816
  }
5810
5817
 
5811
5818
  async uploadAvatar(filePath) {
5819
+ const readable = fs.createReadStream(filePath);
5812
5820
  const result = await this._httpRequest({
5813
5821
  url: "actions/FileUploader/",
5814
5822
  method: "POST",
5815
5823
  data: {
5816
- avatar: fs.createReadStream(filePath),
5824
+ avatar: readable,
5817
5825
  type: "player_avatar_image",
5818
5826
  sId: this._steamIdUser,
5819
5827
  doSub: 1,
@@ -5823,6 +5831,7 @@ export default class SteamUser {
5823
5831
  "content-type": "multipart/form-data",
5824
5832
  },
5825
5833
  });
5834
+ readable.close();
5826
5835
  if (result instanceof ResponseError) {
5827
5836
  return result;
5828
5837
  }
@@ -6272,13 +6281,14 @@ export default class SteamUser {
6272
6281
  };
6273
6282
  }, {});
6274
6283
 
6284
+ const readable = fs.createReadStream(filePath);
6275
6285
  const result = await axios.request({
6276
6286
  url: `${beginFileUploadResult.use_https === 1 ? "https" : "http"}://${beginFileUploadResult.url_host}${beginFileUploadResult.url_path}`,
6277
6287
  method: "PUT",
6278
6288
  headers: headers,
6279
- data: fs.createReadStream(filePath),
6289
+ data: readable,
6280
6290
  });
6281
-
6291
+ readable.close();
6282
6292
  return result;
6283
6293
  }
6284
6294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.75",
3
+ "version": "1.3.77",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",