forked from DeviceFarmer/adbkit
-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi
I cannot seem to successfully get the progress on a push or the syncservice push.
It seems like the promise is not returned before the push is complete or failed, resulting on the PushTransfer object being available after the promise is resolved.
Example code that works, but events are not triggered
pushFileToDevices = async (
device: Device,
localFilePath: string,
remoteFilePath: string
): Promise<void> => {
try {
const sync = await device.getClient().syncService()
const transfer = await sync.push(localFilePath, remoteFilePath)
transfer.on('progress', (stats) => {
console.log(`[${device.id}] Pushed ${stats.bytesTransferred} bytes so far`)
})
transfer.on('end', () => {
console.log(`[${device.id}] Push complete`)
})
console.log(`Pushed ${localFilePath} to ${device.id}:${remoteFilePath}`)
} catch (err) {
console.error(`Could not push ${localFilePath} to ${device.id}:${remoteFilePath}: ${err}`)
}
}
Same result when using then statement instead of awaiting the PushTransfer object.
Metadata
Metadata
Assignees
Labels
No labels