Remote
HTTP client for getting updates and downloading bundles from a remote server.
HTTP client for getting updates and downloading bundles from a remote server.
Constructor
new Remote(config: RemoteConfig);Prop
Type
Methods
Prop
Type
Examples
const remote = new Remote({ baseUrl: 'https://updates.example.com' });
const response = await remote.getUpdate();
if (response != null) {
for (const bundle of response.update.bundles) {
await remote.download(bundle.downloadUrl, `./remote/${bundle.name}/${bundle.version}.wvb`);
}
}constructor
const remote = new Remote({
baseUrl: 'https://updates.example.com',
http: { timeout: 60000 },
onDownload: data => {
const percent = (data.downloadedBytes / data.totalBytes) * 100;
console.log(`Progress: ${percent.toFixed(1)}%`);
},
});