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();

Reusability and concurrency

Technically, a sync connection can be reused to run another command after the previous one finished. However, Google ADB never reuses sync connections, it always creates a new connection for each command.

Tango allows reusing the connection if you don't need to run commands in parallel. Tango uses an internal lock to ensure that only one command is running at a time. Calling another command while a command is still running will wait for the previous command to finish.

Note that some commands use streaming output (e.g. opendir and read), if you don't read the output, the command will never finish.

If you need to run commands in parallel, you should create a new AdbSync instance for each command.

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