Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pics Cache Enhancements #389

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eslint.enable": false
}
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ user.storage.on('read', function(filename, callback) {
});
```

In this manner, you can save data to a database, a cloud service, or anything else you choose.
In this manner, you can save data to a database, a cloud service, or anything else you choose. If both [`savePicsCache`](#savePicsCache) and [`picsCacheAll`](#picsCacheAll) are enabled, it is possible to maintain your own Steam database this way.

### autoRelogin

Expand Down Expand Up @@ -179,6 +179,16 @@ Added in 3.3.0.

Defaults to `false`.

### savePicsCache

If `enablePicsCache` is enabled, saves all product info from [the PICS cache](#picscache) to disk (in [`dataDirectory`](#dataDirectory)) or to your [Custom Storage Engine](#custom-storage-engine). This will significantly speed up the [`appOwnershipCached`](#appOwnershipCache) event from firing and reduce the amount product info requests to Steam. It will only save product info if it's not missing its access token.

Added in {{TODO}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending version bump


Defaults to `false`.

**Warning:** Mind that this will significantly increase the storage usage and space!

### picsCacheAll

If `picsCacheAll` is enabled, `enablePicsCache` is enabled, and `changelistUpdateInterval` is nonzero, then apps and
Expand Down Expand Up @@ -833,6 +843,7 @@ Requests a list of game servers from the master server.
- `callback` - Called when requested data is available
- `err` - An `Error` object on failure, or `null` on success
- `apps` - An object whose keys are AppIDs and whose values are objects
- `sha` - The SHA hash of the app info in hex format (useful to compare to old data)
- `changenumber` - The changenumber of the latest changelist in which this app changed
- `missingToken` - `true` if you need to provide an access token to get more details about this app
- `appinfo` - An object whose structure is identical to the output of `app_info_print` in the [Steam console](steam://nav/console)
Expand Down
13 changes: 13 additions & 0 deletions components/05-filestorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ class SteamUserFileStorage extends SteamUserUtility {
}
};

/**
* @param {Object} files - Keys are filenames, values are Buffer objects containing the file contents
* @return {Promise}
* @protected
*/
async _saveFiles(files) {
if (!this.storage) {
return Promise.reject(new Error('Storage system disabled'));
}

return await this.storage.saveFiles(files);
};

/**
* @param {string} filename
* @returns {Promise<Buffer|null>}
Expand Down
Loading