Skip to main content
Version: next

Overview

Sync command is used to interact with device filesystem.

Sync connection has its own data protocol, so Adb#sync creates a connection that you can run commands on.

Create a sync connection

const sync: AdbSync = await adb.sync();

Concurrency

  1. Each sync connection can only run one command at a time.
  2. Calling another command while a command is still running will wait for the previous command to finish.
  3. Multiple sync connections to the same device can be created to run multiple commands at the same time.
READ ALL STREAMS!

ADB is a multiplexing protocol (multiple logic streams are transferred over one connection), so blocking one stream will block all other streams.

You must continuously read from all sync connections to prevent this from happening.

For example, you can't create another sync connection or call other methods on Adb when opendir is still running. Upcoming data for opendir will block other operations.

Close sync connection

You should close the sync connection when you no longer need it. This closes the underlying socket.

await sync.dispose();
info

Not closing sync connections will cause a small memory leak.

Supported methods