@devicefarmer/adbkit 2.11.3 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.yml +46 -0
- package/CONTRIBUTING.md +28 -0
- package/README.md +749 -759
- package/bin/adbkit +1 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +84 -0
- package/dist/src/Callback.d.ts +2 -0
- package/dist/src/Callback.d.ts.map +1 -0
- package/dist/src/Callback.js +3 -0
- package/dist/src/Callback.js.map +1 -0
- package/dist/src/ClientOptions.d.ts +6 -0
- package/dist/src/ClientOptions.d.ts.map +1 -0
- package/dist/src/ClientOptions.js +3 -0
- package/dist/src/ClientOptions.js.map +1 -0
- package/dist/src/CpuStats.d.ts +17 -0
- package/dist/src/CpuStats.d.ts.map +1 -0
- package/dist/src/CpuStats.js +3 -0
- package/dist/src/CpuStats.js.map +1 -0
- package/dist/src/Device.d.ts +5 -0
- package/dist/src/Device.d.ts.map +1 -0
- package/dist/src/Device.js +3 -0
- package/dist/src/Device.js.map +1 -0
- package/dist/src/DeviceWithPath.d.ts +9 -0
- package/dist/src/DeviceWithPath.d.ts.map +1 -0
- package/dist/src/DeviceWithPath.js +3 -0
- package/dist/src/DeviceWithPath.js.map +1 -0
- package/dist/src/ExtendedPublicKey.d.ts +7 -0
- package/dist/src/ExtendedPublicKey.d.ts.map +1 -0
- package/dist/src/ExtendedPublicKey.js +3 -0
- package/dist/src/ExtendedPublicKey.js.map +1 -0
- package/dist/src/Features.d.ts +2 -0
- package/dist/src/Features.d.ts.map +1 -0
- package/dist/src/Features.js +3 -0
- package/dist/src/Features.js.map +1 -0
- package/dist/src/Forward.d.ts +6 -0
- package/dist/src/Forward.d.ts.map +1 -0
- package/dist/src/Forward.js +3 -0
- package/dist/src/Forward.js.map +1 -0
- package/dist/src/FramebufferMeta.d.ts +60 -0
- package/dist/src/FramebufferMeta.d.ts.map +1 -0
- package/dist/src/FramebufferMeta.js +3 -0
- package/dist/src/FramebufferMeta.js.map +1 -0
- package/dist/src/FramebufferStreamWithMeta.d.ts +10 -0
- package/dist/src/FramebufferStreamWithMeta.d.ts.map +1 -0
- package/dist/src/FramebufferStreamWithMeta.js +3 -0
- package/dist/src/FramebufferStreamWithMeta.js.map +1 -0
- package/dist/src/Properties.d.ts +2 -0
- package/dist/src/Properties.d.ts.map +1 -0
- package/dist/src/Properties.js +3 -0
- package/dist/src/Properties.js.map +1 -0
- package/dist/src/Reverse.d.ts +5 -0
- package/dist/src/Reverse.d.ts.map +1 -0
- package/dist/src/Reverse.js +3 -0
- package/dist/src/Reverse.js.map +1 -0
- package/dist/src/SocketOptions.d.ts +6 -0
- package/dist/src/SocketOptions.d.ts.map +1 -0
- package/dist/src/SocketOptions.js +3 -0
- package/dist/src/SocketOptions.js.map +1 -0
- package/dist/src/StartActivityOptions.d.ts +12 -0
- package/dist/src/StartActivityOptions.d.ts.map +1 -0
- package/dist/src/StartActivityOptions.js +3 -0
- package/dist/src/StartActivityOptions.js.map +1 -0
- package/dist/src/StartServiceOptions.d.ts +57 -0
- package/dist/src/StartServiceOptions.d.ts.map +1 -0
- package/dist/src/StartServiceOptions.js +3 -0
- package/dist/src/StartServiceOptions.js.map +1 -0
- package/dist/src/TrackerChangeSet.d.ts +7 -0
- package/dist/src/TrackerChangeSet.d.ts.map +1 -0
- package/dist/src/TrackerChangeSet.js +3 -0
- package/dist/src/TrackerChangeSet.js.map +1 -0
- package/dist/src/WithToString.d.ts +4 -0
- package/dist/src/WithToString.d.ts.map +1 -0
- package/dist/src/WithToString.js +3 -0
- package/dist/src/WithToString.js.map +1 -0
- package/dist/src/adb/DeviceClient.d.ts +376 -0
- package/dist/src/adb/DeviceClient.d.ts.map +1 -0
- package/dist/src/adb/DeviceClient.js +517 -0
- package/dist/src/adb/DeviceClient.js.map +1 -0
- package/dist/src/adb/auth.d.ts +8 -0
- package/dist/src/adb/auth.d.ts.map +1 -0
- package/dist/src/adb/auth.js +87 -0
- package/dist/src/adb/auth.js.map +1 -0
- package/dist/src/adb/client.d.ts +29 -0
- package/dist/src/adb/client.d.ts.map +1 -0
- package/dist/src/adb/client.js +73 -0
- package/dist/src/adb/client.js.map +1 -0
- package/dist/src/adb/command/host/connect.d.ts +6 -0
- package/dist/src/adb/command/host/connect.d.ts.map +1 -0
- package/dist/src/adb/command/host/connect.js +36 -0
- package/dist/src/adb/command/host/connect.js.map +1 -0
- package/dist/src/adb/command/host/devices.d.ts +10 -0
- package/dist/src/adb/command/host/devices.d.ts.map +1 -0
- package/dist/src/adb/command/host/devices.js +40 -0
- package/dist/src/adb/command/host/devices.js.map +1 -0
- package/dist/src/adb/command/host/deviceswithpaths.d.ts +9 -0
- package/dist/src/adb/command/host/deviceswithpaths.d.ts.map +1 -0
- package/dist/src/adb/command/host/deviceswithpaths.js +46 -0
- package/dist/src/adb/command/host/deviceswithpaths.js.map +1 -0
- package/dist/src/adb/command/host/disconnect.d.ts +6 -0
- package/dist/src/adb/command/host/disconnect.d.ts.map +1 -0
- package/dist/src/adb/command/host/disconnect.js +35 -0
- package/dist/src/adb/command/host/disconnect.js.map +1 -0
- package/dist/src/adb/command/host/index.d.ts +9 -0
- package/dist/src/adb/command/host/index.d.ts.map +1 -0
- package/dist/src/adb/command/host/index.js +23 -0
- package/dist/src/adb/command/host/index.js.map +1 -0
- package/dist/src/adb/command/host/kill.d.ts +6 -0
- package/dist/src/adb/command/host/kill.d.ts.map +1 -0
- package/dist/src/adb/command/host/kill.js +24 -0
- package/dist/src/adb/command/host/kill.js.map +1 -0
- package/dist/src/adb/command/host/trackdevices.d.ts +6 -0
- package/dist/src/adb/command/host/trackdevices.d.ts.map +1 -0
- package/dist/src/adb/command/host/trackdevices.js +27 -0
- package/dist/src/adb/command/host/trackdevices.js.map +1 -0
- package/dist/src/adb/command/host/transport.d.ts +6 -0
- package/dist/src/adb/command/host/transport.d.ts.map +1 -0
- package/dist/src/adb/command/host/transport.js +24 -0
- package/dist/src/adb/command/host/transport.js.map +1 -0
- package/dist/src/adb/command/host/version.d.ts +7 -0
- package/dist/src/adb/command/host/version.d.ts.map +1 -0
- package/dist/src/adb/command/host/version.js +29 -0
- package/dist/src/adb/command/host/version.js.map +1 -0
- package/dist/src/adb/command/host-serial/forward.d.ts +6 -0
- package/dist/src/adb/command/host-serial/forward.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/forward.js +33 -0
- package/dist/src/adb/command/host-serial/forward.js.map +1 -0
- package/dist/src/adb/command/host-serial/getdevicepath.d.ts +6 -0
- package/dist/src/adb/command/host-serial/getdevicepath.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/getdevicepath.js +26 -0
- package/dist/src/adb/command/host-serial/getdevicepath.js.map +1 -0
- package/dist/src/adb/command/host-serial/getserialno.d.ts +6 -0
- package/dist/src/adb/command/host-serial/getserialno.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/getserialno.js +24 -0
- package/dist/src/adb/command/host-serial/getserialno.js.map +1 -0
- package/dist/src/adb/command/host-serial/getstate.d.ts +6 -0
- package/dist/src/adb/command/host-serial/getstate.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/getstate.js +24 -0
- package/dist/src/adb/command/host-serial/getstate.js.map +1 -0
- package/dist/src/adb/command/host-serial/index.d.ts +7 -0
- package/dist/src/adb/command/host-serial/index.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/index.js +19 -0
- package/dist/src/adb/command/host-serial/index.js.map +1 -0
- package/dist/src/adb/command/host-serial/listforwards.d.ts +8 -0
- package/dist/src/adb/command/host-serial/listforwards.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/listforwards.js +34 -0
- package/dist/src/adb/command/host-serial/listforwards.js.map +1 -0
- package/dist/src/adb/command/host-serial/waitfordevice.d.ts +6 -0
- package/dist/src/adb/command/host-serial/waitfordevice.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/waitfordevice.js +33 -0
- package/dist/src/adb/command/host-serial/waitfordevice.js.map +1 -0
- package/dist/src/adb/command/host-transport/clear.d.ts +6 -0
- package/dist/src/adb/command/host-transport/clear.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/clear.js +39 -0
- package/dist/src/adb/command/host-transport/clear.js.map +1 -0
- package/dist/src/adb/command/host-transport/framebuffer.d.ts +12 -0
- package/dist/src/adb/command/host-transport/framebuffer.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/framebuffer.js +113 -0
- package/dist/src/adb/command/host-transport/framebuffer.js.map +1 -0
- package/dist/src/adb/command/host-transport/getfeatures.d.ts +8 -0
- package/dist/src/adb/command/host-transport/getfeatures.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/getfeatures.js +35 -0
- package/dist/src/adb/command/host-transport/getfeatures.js.map +1 -0
- package/dist/src/adb/command/host-transport/getpackages.d.ts +7 -0
- package/dist/src/adb/command/host-transport/getpackages.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/getpackages.js +45 -0
- package/dist/src/adb/command/host-transport/getpackages.js.map +1 -0
- package/dist/src/adb/command/host-transport/getproperties.d.ts +8 -0
- package/dist/src/adb/command/host-transport/getproperties.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/getproperties.js +37 -0
- package/dist/src/adb/command/host-transport/getproperties.js.map +1 -0
- package/dist/src/adb/command/host-transport/index.d.ts +28 -0
- package/dist/src/adb/command/host-transport/index.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/index.js +61 -0
- package/dist/src/adb/command/host-transport/index.js.map +1 -0
- package/dist/src/adb/command/host-transport/install.d.ts +6 -0
- package/dist/src/adb/command/host-transport/install.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/install.js +42 -0
- package/dist/src/adb/command/host-transport/install.js.map +1 -0
- package/dist/src/adb/command/host-transport/isinstalled.d.ts +6 -0
- package/dist/src/adb/command/host-transport/isinstalled.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/isinstalled.js +37 -0
- package/dist/src/adb/command/host-transport/isinstalled.js.map +1 -0
- package/dist/src/adb/command/host-transport/listreverses.d.ts +8 -0
- package/dist/src/adb/command/host-transport/listreverses.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/listreverses.js +38 -0
- package/dist/src/adb/command/host-transport/listreverses.js.map +1 -0
- package/dist/src/adb/command/host-transport/local.d.ts +8 -0
- package/dist/src/adb/command/host-transport/local.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/local.js +24 -0
- package/dist/src/adb/command/host-transport/local.js.map +1 -0
- package/dist/src/adb/command/host-transport/log.d.ts +8 -0
- package/dist/src/adb/command/host-transport/log.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/log.js +24 -0
- package/dist/src/adb/command/host-transport/log.js.map +1 -0
- package/dist/src/adb/command/host-transport/logcat.d.ts +9 -0
- package/dist/src/adb/command/host-transport/logcat.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/logcat.js +37 -0
- package/dist/src/adb/command/host-transport/logcat.js.map +1 -0
- package/dist/src/adb/command/host-transport/monkey.d.ts +8 -0
- package/dist/src/adb/command/host-transport/monkey.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/monkey.js +50 -0
- package/dist/src/adb/command/host-transport/monkey.js.map +1 -0
- package/dist/src/adb/command/host-transport/reboot.d.ts +6 -0
- package/dist/src/adb/command/host-transport/reboot.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/reboot.js +24 -0
- package/dist/src/adb/command/host-transport/reboot.js.map +1 -0
- package/dist/src/adb/command/host-transport/remount.d.ts +6 -0
- package/dist/src/adb/command/host-transport/remount.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/remount.js +24 -0
- package/dist/src/adb/command/host-transport/remount.js.map +1 -0
- package/dist/src/adb/command/host-transport/reverse.d.ts +6 -0
- package/dist/src/adb/command/host-transport/reverse.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/reverse.js +33 -0
- package/dist/src/adb/command/host-transport/reverse.js.map +1 -0
- package/dist/src/adb/command/host-transport/root.d.ts +6 -0
- package/dist/src/adb/command/host-transport/root.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/root.js +32 -0
- package/dist/src/adb/command/host-transport/root.js.map +1 -0
- package/dist/src/adb/command/host-transport/screencap.d.ts +8 -0
- package/dist/src/adb/command/host-transport/screencap.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/screencap.js +36 -0
- package/dist/src/adb/command/host-transport/screencap.js.map +1 -0
- package/dist/src/adb/command/host-transport/shell.d.ts +9 -0
- package/dist/src/adb/command/host-transport/shell.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/shell.js +27 -0
- package/dist/src/adb/command/host-transport/shell.js.map +1 -0
- package/dist/src/adb/command/host-transport/startactivity.d.ts +13 -0
- package/dist/src/adb/command/host-transport/startactivity.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/startactivity.js +166 -0
- package/dist/src/adb/command/host-transport/startactivity.js.map +1 -0
- package/dist/src/adb/command/host-transport/startservice.d.ts +7 -0
- package/dist/src/adb/command/host-transport/startservice.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/startservice.js +17 -0
- package/dist/src/adb/command/host-transport/startservice.js.map +1 -0
- package/dist/src/adb/command/host-transport/sync.d.ts +7 -0
- package/dist/src/adb/command/host-transport/sync.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/sync.js +25 -0
- package/dist/src/adb/command/host-transport/sync.js.map +1 -0
- package/dist/src/adb/command/host-transport/tcp.d.ts +8 -0
- package/dist/src/adb/command/host-transport/tcp.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/tcp.js +24 -0
- package/dist/src/adb/command/host-transport/tcp.js.map +1 -0
- package/dist/src/adb/command/host-transport/tcpip.d.ts +6 -0
- package/dist/src/adb/command/host-transport/tcpip.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/tcpip.js +32 -0
- package/dist/src/adb/command/host-transport/tcpip.js.map +1 -0
- package/dist/src/adb/command/host-transport/trackjdwp.d.ts +7 -0
- package/dist/src/adb/command/host-transport/trackjdwp.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/trackjdwp.js +25 -0
- package/dist/src/adb/command/host-transport/trackjdwp.js.map +1 -0
- package/dist/src/adb/command/host-transport/uninstall.d.ts +6 -0
- package/dist/src/adb/command/host-transport/uninstall.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/uninstall.js +40 -0
- package/dist/src/adb/command/host-transport/uninstall.js.map +1 -0
- package/dist/src/adb/command/host-transport/usb.d.ts +6 -0
- package/dist/src/adb/command/host-transport/usb.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/usb.js +32 -0
- package/dist/src/adb/command/host-transport/usb.js.map +1 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.d.ts +6 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.js +27 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.js.map +1 -0
- package/dist/src/adb/command.d.ts +17 -0
- package/dist/src/adb/command.d.ts.map +1 -0
- package/dist/src/adb/command.js +43 -0
- package/dist/src/adb/command.js.map +1 -0
- package/dist/src/adb/connection.d.ts +24 -0
- package/dist/src/adb/connection.d.ts.map +1 -0
- package/dist/src/adb/connection.js +115 -0
- package/dist/src/adb/connection.js.map +1 -0
- package/dist/src/adb/dump.d.ts +4 -0
- package/dist/src/adb/dump.d.ts.map +1 -0
- package/dist/src/adb/dump.js +38 -0
- package/dist/src/adb/dump.js.map +1 -0
- package/dist/src/adb/framebuffer/rgbtransform.d.ts +16 -0
- package/dist/src/adb/framebuffer/rgbtransform.d.ts.map +1 -0
- package/dist/src/adb/framebuffer/rgbtransform.js +47 -0
- package/dist/src/adb/framebuffer/rgbtransform.js.map +1 -0
- package/dist/src/adb/jdwptracker.d.ts +41 -0
- package/dist/src/adb/jdwptracker.d.ts.map +1 -0
- package/dist/src/adb/jdwptracker.js +85 -0
- package/dist/src/adb/jdwptracker.js.map +1 -0
- package/dist/src/adb/keycode.d.ts +292 -0
- package/dist/src/adb/keycode.d.ts.map +1 -0
- package/dist/src/adb/keycode.js +298 -0
- package/dist/src/adb/keycode.js.map +1 -0
- package/dist/src/adb/linetransform.d.ts +17 -0
- package/dist/src/adb/linetransform.d.ts.map +1 -0
- package/dist/src/adb/linetransform.js +93 -0
- package/dist/src/adb/linetransform.js.map +1 -0
- package/dist/src/adb/parser.d.ts +37 -0
- package/dist/src/adb/parser.d.ts.map +1 -0
- package/dist/src/adb/parser.js +269 -0
- package/dist/src/adb/parser.js.map +1 -0
- package/dist/src/adb/proc/stat.d.ts +30 -0
- package/dist/src/adb/proc/stat.d.ts.map +1 -0
- package/dist/src/adb/proc/stat.js +131 -0
- package/dist/src/adb/proc/stat.js.map +1 -0
- package/dist/src/adb/protocol.d.ts +17 -0
- package/dist/src/adb/protocol.d.ts.map +1 -0
- package/dist/src/adb/protocol.js +29 -0
- package/dist/src/adb/protocol.js.map +1 -0
- package/dist/src/adb/sync/entry.d.ts +8 -0
- package/dist/src/adb/sync/entry.d.ts.map +1 -0
- package/dist/src/adb/sync/entry.js +16 -0
- package/dist/src/adb/sync/entry.js.map +1 -0
- package/dist/src/adb/sync/pulltransfer.d.ts +10 -0
- package/dist/src/adb/sync/pulltransfer.d.ts.map +1 -0
- package/dist/src/adb/sync/pulltransfer.js +24 -0
- package/dist/src/adb/sync/pulltransfer.js.map +1 -0
- package/dist/src/adb/sync/pushtransfer.d.ts +13 -0
- package/dist/src/adb/sync/pushtransfer.d.ts.map +1 -0
- package/dist/src/adb/sync/pushtransfer.js +30 -0
- package/dist/src/adb/sync/pushtransfer.js.map +1 -0
- package/dist/src/adb/sync/stats.d.ts +23 -0
- package/dist/src/adb/sync/stats.d.ts.map +1 -0
- package/dist/src/adb/sync/stats.js +54 -0
- package/dist/src/adb/sync/stats.js.map +1 -0
- package/dist/src/adb/sync.d.ts +31 -0
- package/dist/src/adb/sync.d.ts.map +1 -0
- package/dist/src/adb/sync.js +322 -0
- package/dist/src/adb/sync.js.map +1 -0
- package/dist/src/adb/tcpusb/packet.d.ts +27 -0
- package/dist/src/adb/tcpusb/packet.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/packet.js +94 -0
- package/dist/src/adb/tcpusb/packet.js.map +1 -0
- package/dist/src/adb/tcpusb/packetreader.d.ts +26 -0
- package/dist/src/adb/tcpusb/packetreader.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/packetreader.js +100 -0
- package/dist/src/adb/tcpusb/packetreader.js.map +1 -0
- package/dist/src/adb/tcpusb/rollingcounter.d.ts +8 -0
- package/dist/src/adb/tcpusb/rollingcounter.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/rollingcounter.js +17 -0
- package/dist/src/adb/tcpusb/rollingcounter.js.map +1 -0
- package/dist/src/adb/tcpusb/server.d.ts +19 -0
- package/dist/src/adb/tcpusb/server.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/server.js +78 -0
- package/dist/src/adb/tcpusb/server.js.map +1 -0
- package/dist/src/adb/tcpusb/service.d.ts +37 -0
- package/dist/src/adb/tcpusb/service.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/service.js +173 -0
- package/dist/src/adb/tcpusb/service.js.map +1 -0
- package/dist/src/adb/tcpusb/servicemap.d.ts +10 -0
- package/dist/src/adb/tcpusb/servicemap.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/servicemap.js +42 -0
- package/dist/src/adb/tcpusb/servicemap.js.map +1 -0
- package/dist/src/adb/tcpusb/socket.d.ts +45 -0
- package/dist/src/adb/tcpusb/socket.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/socket.js +284 -0
- package/dist/src/adb/tcpusb/socket.js.map +1 -0
- package/dist/src/adb/tracker.d.ts +17 -0
- package/dist/src/adb/tracker.d.ts.map +1 -0
- package/dist/src/adb/tracker.js +72 -0
- package/dist/src/adb/tracker.js.map +1 -0
- package/dist/src/adb/util.d.ts +10 -0
- package/dist/src/adb/util.d.ts.map +1 -0
- package/dist/src/adb/util.js +17 -0
- package/dist/src/adb/util.js.map +1 -0
- package/dist/src/adb.d.ts +13 -0
- package/dist/src/adb.d.ts.map +1 -0
- package/dist/src/adb.js +28 -0
- package/dist/src/adb.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +86 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +12 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +53 -33
- package/.semaphore/publish.yml +0 -19
- package/.semaphore/semaphore.yml +0 -27
- package/index.js +0 -4
- package/lib/adb/auth.js +0 -78
- package/lib/adb/client.js +0 -576
- package/lib/adb/command/host/connect.js +0 -46
- package/lib/adb/command/host/devices.js +0 -64
- package/lib/adb/command/host/deviceswithpaths.js +0 -70
- package/lib/adb/command/host/disconnect.js +0 -46
- package/lib/adb/command/host/kill.js +0 -36
- package/lib/adb/command/host/trackdevices.js +0 -40
- package/lib/adb/command/host/transport.js +0 -36
- package/lib/adb/command/host/version.js +0 -42
- package/lib/adb/command/host-serial/forward.js +0 -45
- package/lib/adb/command/host-serial/getdevicepath.js +0 -38
- package/lib/adb/command/host-serial/getserialno.js +0 -38
- package/lib/adb/command/host-serial/getstate.js +0 -38
- package/lib/adb/command/host-serial/listforwards.js +0 -56
- package/lib/adb/command/host-serial/waitfordevice.js +0 -45
- package/lib/adb/command/host-transport/clear.js +0 -45
- package/lib/adb/command/host-transport/framebuffer.js +0 -114
- package/lib/adb/command/host-transport/getfeatures.js +0 -51
- package/lib/adb/command/host-transport/getpackages.js +0 -51
- package/lib/adb/command/host-transport/getproperties.js +0 -51
- package/lib/adb/command/host-transport/install.js +0 -48
- package/lib/adb/command/host-transport/isinstalled.js +0 -47
- package/lib/adb/command/host-transport/listreverses.js +0 -55
- package/lib/adb/command/host-transport/local.js +0 -36
- package/lib/adb/command/host-transport/log.js +0 -36
- package/lib/adb/command/host-transport/logcat.js +0 -48
- package/lib/adb/command/host-transport/monkey.js +0 -42
- package/lib/adb/command/host-transport/reboot.js +0 -36
- package/lib/adb/command/host-transport/remount.js +0 -36
- package/lib/adb/command/host-transport/reverse.js +0 -45
- package/lib/adb/command/host-transport/root.js +0 -46
- package/lib/adb/command/host-transport/screencap.js +0 -52
- package/lib/adb/command/host-transport/shell.js +0 -39
- package/lib/adb/command/host-transport/startactivity.js +0 -184
- package/lib/adb/command/host-transport/startservice.js +0 -33
- package/lib/adb/command/host-transport/sync.js +0 -38
- package/lib/adb/command/host-transport/tcp.js +0 -36
- package/lib/adb/command/host-transport/tcpip.js +0 -46
- package/lib/adb/command/host-transport/trackjdwp.js +0 -120
- package/lib/adb/command/host-transport/uninstall.js +0 -44
- package/lib/adb/command/host-transport/usb.js +0 -46
- package/lib/adb/command/host-transport/waitbootcomplete.js +0 -42
- package/lib/adb/command.js +0 -56
- package/lib/adb/connection.js +0 -117
- package/lib/adb/dump.js +0 -15
- package/lib/adb/framebuffer/rgbtransform.js +0 -55
- package/lib/adb/keycode.js +0 -225
- package/lib/adb/linetransform.js +0 -87
- package/lib/adb/parser.js +0 -291
- package/lib/adb/proc/stat.js +0 -137
- package/lib/adb/protocol.js +0 -45
- package/lib/adb/sync/entry.js +0 -23
- package/lib/adb/sync/pulltransfer.js +0 -31
- package/lib/adb/sync/pushtransfer.js +0 -40
- package/lib/adb/sync/stats.js +0 -54
- package/lib/adb/sync.js +0 -343
- package/lib/adb/tcpusb/packet.js +0 -112
- package/lib/adb/tcpusb/packetreader.js +0 -121
- package/lib/adb/tcpusb/rollingcounter.js +0 -21
- package/lib/adb/tcpusb/server.js +0 -79
- package/lib/adb/tcpusb/service.js +0 -203
- package/lib/adb/tcpusb/servicemap.js +0 -48
- package/lib/adb/tcpusb/socket.js +0 -312
- package/lib/adb/tracker.js +0 -89
- package/lib/adb/util.js +0 -13
- package/lib/adb.js +0 -29
- package/lib/cli.js +0 -66
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# adbkit
|
|
2
2
|
|
|
3
|
-
_**Interested in helping to convert the CoffeeScript codebase to plain JavaScript? [Help us](https://github.com/openstf/adbkit/issues/48)!**_
|
|
4
|
-
|
|
5
3
|
**adbkit** is a pure [Node.js][nodejs] client for the [Android Debug Bridge][adb-site] server. It can be used either as a library in your own application, or simply as a convenient utility for playing with your device.
|
|
6
4
|
|
|
7
5
|
Most of the `adb` command line tool's functionality is supported (including pushing/pulling files, installing APKs and processing logs), with some added functionality such as being able to generate touch/key events and take screenshots. Some shims are provided for older devices, but we have not and will not test anything below Android 2.3.
|
|
@@ -10,8 +8,8 @@ Internally, we use this library to drive a multitude of Android devices from a v
|
|
|
10
8
|
|
|
11
9
|
## Requirements
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
- [Node.js][nodejs] >= 0.10
|
|
12
|
+
- The `adb` command line tool
|
|
15
13
|
|
|
16
14
|
Please note that although it may happen at some point, **this project is NOT an implementation of the ADB _server_**. The target host (where the devices are connected) must still have ADB installed and either already running (e.g. via `adb start-server`) or available in `$PATH`. An attempt will be made to start the server locally via the aforementioned command if the initial connection fails. This is the only case where we fall back to the `adb` binary.
|
|
17
15
|
|
|
@@ -19,192 +17,171 @@ When targeting a remote host, starting the server is entirely your responsibilit
|
|
|
19
17
|
|
|
20
18
|
Alternatively, you may want to consider using the Chrome [ADB][chrome-adb] extension, as it includes the ADB server and can be started/stopped quite easily.
|
|
21
19
|
|
|
20
|
+
For Linux users, adb need `plugdev` group acess, So you may need to add your current user to `plugdev` group.
|
|
21
|
+
`sudo usermod -a -G plugdev $USER`
|
|
22
|
+
|
|
22
23
|
## Getting started
|
|
23
24
|
|
|
24
25
|
Install via NPM:
|
|
25
26
|
|
|
26
27
|
```bash
|
|
27
|
-
npm install --save adbkit
|
|
28
|
+
npm install --save @devicefarmer/adbkit
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
We use [debug][node-debug], and our debug namespace is `adb`. Some of the dependencies may provide debug output of their own. To see the debug output, set the `DEBUG` environment variable. For example, run your program with `DEBUG=adb:* node app.js`.
|
|
31
32
|
|
|
32
|
-
Note that even though the module is written in [CoffeeScript][coffeescript], only the compiled JavaScript is published to [NPM][npm], which means that it can easily be used with pure JavaScript codebases, too.
|
|
33
|
-
|
|
34
33
|
### Examples
|
|
35
34
|
|
|
36
35
|
The examples may be a bit verbose, but that's because we're trying to keep them as close to real-life code as possible, with flow control and error handling taken care of.
|
|
37
36
|
|
|
38
37
|
#### Checking for NFC support
|
|
39
38
|
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
console.error('Something went wrong:', err.stack)
|
|
59
|
-
})
|
|
39
|
+
```typescript
|
|
40
|
+
import Bluebird from 'bluebird';
|
|
41
|
+
import Adb from '@devicefarmer/adbkit';
|
|
42
|
+
|
|
43
|
+
const client = Adb.createClient();
|
|
44
|
+
|
|
45
|
+
const test = async () => {
|
|
46
|
+
try {
|
|
47
|
+
const devices = await client.listDevices();
|
|
48
|
+
const supportedDevices = await Bluebird.filter(devices, async (device) => {
|
|
49
|
+
const features = await client.getFeatures(device.id);
|
|
50
|
+
return features['android.hardware.nfc'];
|
|
51
|
+
});
|
|
52
|
+
console.log('The following devices support NFC:', supportedDevices);
|
|
53
|
+
} catch (err) {
|
|
54
|
+
console.error('Something went wrong:', err.stack);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
60
57
|
```
|
|
61
58
|
|
|
62
59
|
#### Installing an APK
|
|
63
60
|
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
console.error('Something went wrong:', err.stack)
|
|
81
|
-
})
|
|
61
|
+
```typescript
|
|
62
|
+
import Bluebird from 'bluebird';
|
|
63
|
+
import Adb from '@devicefarmer/adbkit';
|
|
64
|
+
|
|
65
|
+
const client = Adb.createClient();
|
|
66
|
+
const apk = 'vendor/app.apk';
|
|
67
|
+
|
|
68
|
+
const test = async () => {
|
|
69
|
+
try {
|
|
70
|
+
const devices = await client.listDevices();
|
|
71
|
+
await Bluebird.map(devices, (device) => client.install(device.id, apk));
|
|
72
|
+
console.log(`Installed ${apk} on all connected devices`);
|
|
73
|
+
} catch (err) {
|
|
74
|
+
console.error('Something went wrong:', err.stack);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
82
77
|
```
|
|
83
78
|
|
|
84
79
|
#### Tracking devices
|
|
85
80
|
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})
|
|
101
|
-
})
|
|
102
|
-
.catch(function(err) {
|
|
103
|
-
console.error('Something went wrong:', err.stack)
|
|
104
|
-
})
|
|
81
|
+
```typescript
|
|
82
|
+
import Adb from '@devicefarmer/adbkit';
|
|
83
|
+
|
|
84
|
+
const client = Adb.createClient();
|
|
85
|
+
const test = async () => {
|
|
86
|
+
try {
|
|
87
|
+
const tracker = await client.trackDevices();
|
|
88
|
+
tracker.on('add', (device) => console.log('Device %s was plugged in', device.id));
|
|
89
|
+
tracker.on('remove', (device) => console.log('Device %s was unplugged', device.id));
|
|
90
|
+
tracker.on('end', () => console.log('Tracking stopped'));
|
|
91
|
+
} catch (err) {
|
|
92
|
+
console.error('Something went wrong:', err.stack);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
105
95
|
```
|
|
106
96
|
|
|
107
97
|
#### Pulling a file from all connected devices
|
|
108
98
|
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
console.log('Done pulling /system/build.prop from all connected devices')
|
|
139
|
-
})
|
|
140
|
-
.catch(function(err) {
|
|
141
|
-
console.error('Something went wrong:', err.stack)
|
|
142
|
-
})
|
|
99
|
+
```typescript
|
|
100
|
+
import Bluebird from 'bluebird';
|
|
101
|
+
import fs from 'fs';
|
|
102
|
+
import Adb from '@devicefarmer/adbkit';
|
|
103
|
+
const client = Adb.createClient();
|
|
104
|
+
|
|
105
|
+
const test = async () => {
|
|
106
|
+
try {
|
|
107
|
+
const devices = await client.listDevices();
|
|
108
|
+
await Bluebird.map(devices, async (device) => {
|
|
109
|
+
const transfer = await client.pull(device.id, '/system/build.prop');
|
|
110
|
+
const fn = `/tmp/${device.id}.build.prop`;
|
|
111
|
+
await new Bluebird((resolve, reject) => {
|
|
112
|
+
transfer.on('progress', (stats) =>
|
|
113
|
+
console.log(`[${device.id}] Pulled ${stats.bytesTransferred} bytes so far`),
|
|
114
|
+
);
|
|
115
|
+
transfer.on('end', () => {
|
|
116
|
+
console.log(`[${device.id}] Pull complete`);
|
|
117
|
+
resolve(device.id);
|
|
118
|
+
});
|
|
119
|
+
transfer.on('error', reject);
|
|
120
|
+
transfer.pipe(fs.createWriteStream(fn));
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
console.log('Done pulling /system/build.prop from all connected devices');
|
|
124
|
+
} catch (err) {
|
|
125
|
+
console.error('Something went wrong:', err.stack);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
143
128
|
```
|
|
144
129
|
|
|
145
130
|
#### Pushing a file to all connected devices
|
|
146
131
|
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
console.log('Done pushing foo.txt to all connected devices')
|
|
174
|
-
})
|
|
175
|
-
.catch(function(err) {
|
|
176
|
-
console.error('Something went wrong:', err.stack)
|
|
177
|
-
})
|
|
132
|
+
```typescript
|
|
133
|
+
import Bluebird from 'bluebird';
|
|
134
|
+
import Adb from '@devicefarmer/adbkit';
|
|
135
|
+
const client = Adb.createClient();
|
|
136
|
+
|
|
137
|
+
const test = async () => {
|
|
138
|
+
try {
|
|
139
|
+
const devices = await client.listDevices();
|
|
140
|
+
await Bluebird.map(devices, async (device) => {
|
|
141
|
+
const transfer = await client.push(device.id, 'temp/foo.txt', '/data/local/tmp/foo.txt');
|
|
142
|
+
await new Bluebird(function (resolve, reject) {
|
|
143
|
+
transfer.on('progress', (stats) =>
|
|
144
|
+
console.log(`[${device.id}] Pushed ${stats.bytesTransferred} bytes so far`),
|
|
145
|
+
);
|
|
146
|
+
transfer.on('end', () => {
|
|
147
|
+
console.log('[${device.id}] Push complete');
|
|
148
|
+
resolve();
|
|
149
|
+
});
|
|
150
|
+
transfer.on('error', reject);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
console.log('Done pushing foo.txt to all connected devices');
|
|
154
|
+
} catch (err) {
|
|
155
|
+
console.error('Something went wrong:', err.stack);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
178
158
|
```
|
|
179
159
|
|
|
180
160
|
#### List files in a folder
|
|
181
161
|
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
.catch(function(err) {
|
|
206
|
-
console.error('Something went wrong:', err.stack)
|
|
207
|
-
})
|
|
162
|
+
```typescript
|
|
163
|
+
import Bluebird from 'bluebird';
|
|
164
|
+
import Adb from '@devicefarmer/adbkit';
|
|
165
|
+
const client = Adb.createClient();
|
|
166
|
+
|
|
167
|
+
const test = async () => {
|
|
168
|
+
try {
|
|
169
|
+
const devices = await client.listDevices();
|
|
170
|
+
await Bluebird.map(devices, async (device) => {
|
|
171
|
+
const files = await client.readdir(device.id, '/sdcard');
|
|
172
|
+
// Synchronous, so we don't have to care about returning at the
|
|
173
|
+
// right time
|
|
174
|
+
files.forEach((file) => {
|
|
175
|
+
if (file.isFile()) {
|
|
176
|
+
console.log(`[${device.id}] Found file "${file.name}"`);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
console.log('Done checking /sdcard files on connected devices');
|
|
181
|
+
} catch (err) {
|
|
182
|
+
console.error('Something went wrong:', err.stack);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
208
185
|
```
|
|
209
186
|
|
|
210
187
|
## API
|
|
@@ -215,524 +192,535 @@ client.listDevices()
|
|
|
215
192
|
|
|
216
193
|
Creates a client instance with the provided options. Note that this will not automatically establish a connection, it will only be done when necessary.
|
|
217
194
|
|
|
218
|
-
|
|
219
|
-
-
|
|
220
|
-
-
|
|
221
|
-
-
|
|
222
|
-
|
|
195
|
+
- **options** An object compatible with [Net.connect][net-connect]'s options:
|
|
196
|
+
- **port** The port where the ADB server is listening. Defaults to `5037`.
|
|
197
|
+
- **host** The host of the ADB server. Defaults to `'127.0.0.1'`.
|
|
198
|
+
- **bin** As the sole exception, this option provides the path to the `adb` binary, used for starting the server locally if initial connection fails. Defaults to `'adb'`.
|
|
199
|
+
- Returns: The client instance.
|
|
223
200
|
|
|
224
|
-
#### adb.util.parsePublicKey(androidKey
|
|
201
|
+
#### adb.util.parsePublicKey(androidKey)
|
|
225
202
|
|
|
226
203
|
Parses an Android-formatted mincrypt public key (e.g. `~/.android/adbkey.pub`).
|
|
227
204
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
-
|
|
231
|
-
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
205
|
+
- **androidKey** The key String or [`Buffer`][node-buffer] to parse. Not a filename.
|
|
206
|
+
- **callback(err, output)** Optional. Use this or the returned `Promise`.
|
|
207
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
208
|
+
- **key** The key as a [forge.pki](https://github.com/digitalbazaar/forge#rsa) public key. You may need [node-forge](https://github.com/digitalbazaar/forge) for complicated operations. Additionally the following properties are present:
|
|
209
|
+
- **fingerprint** The key fingerprint, like it would display on a device. Note that this is different than the one you'd get from `forge.ssh.getPublicKeyFingerprint(key)`, because the device fingerprint is based on the original format.
|
|
210
|
+
- **comment** The key comment, if any.
|
|
211
|
+
- Returns: `Promise`
|
|
212
|
+
- Resolves with: `key` (see callback)
|
|
236
213
|
|
|
237
|
-
#### adb.util.readAll(stream
|
|
214
|
+
#### adb.util.readAll(stream)
|
|
238
215
|
|
|
239
216
|
Takes a [`Stream`][node-stream] and reads everything it outputs until the stream ends. Then it resolves with the collected output. Convenient with `client.shell()`.
|
|
240
217
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
|
|
246
|
-
|
|
218
|
+
- **stream** The [`Stream`][node-stream] to read.
|
|
219
|
+
- **callback(err, output)** Optional. Use this or the returned `Promise`.
|
|
220
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
221
|
+
- **output** All the output as a [`Buffer`][node-buffer]. Use `output.toString('utf-8')` to get a readable string from it.
|
|
222
|
+
- Returns: `Promise`
|
|
223
|
+
- Resolves with: `output` (see callback)
|
|
247
224
|
|
|
248
225
|
### Client
|
|
249
226
|
|
|
250
|
-
#### client.clear(serial, pkg[, callback])
|
|
251
227
|
|
|
252
|
-
|
|
228
|
+
#### client.version()
|
|
229
|
+
|
|
230
|
+
Queries the ADB server for its version. This is mainly useful for backwards-compatibility purposes.
|
|
231
|
+
|
|
232
|
+
- **callback(err, version)** Optional. Use this or the returned `Promise`.
|
|
233
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
234
|
+
- **version** The version of the ADB server.
|
|
235
|
+
- Returns: `Promise`
|
|
236
|
+
- Resolves with: `version` (see callback)
|
|
253
237
|
|
|
254
|
-
* **serial** The serial number of the device. Corresponds to the device ID in `client.listDevices()`.
|
|
255
|
-
* **pkg** The package name. This is NOT the APK.
|
|
256
|
-
* **callback(err)** Optional. Use this or the returned `Promise`.
|
|
257
|
-
- **err** `null` when successful, `Error` otherwise.
|
|
258
|
-
* Returns: `Promise`
|
|
259
|
-
* Resolves with: `true`
|
|
260
238
|
|
|
261
|
-
#### client.connect(host[, port]
|
|
239
|
+
#### client.connect(host[, port])
|
|
262
240
|
|
|
263
241
|
Connects to the given device, which must have its ADB daemon running in tcp mode (see `client.tcpip()`) and be accessible on the same network. Same as `adb connect <host>:<port>`.
|
|
264
242
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
-
|
|
269
|
-
-
|
|
270
|
-
|
|
271
|
-
|
|
243
|
+
- **host** The target host. Can also contain the port, in which case the port argument is not used and can be skipped.
|
|
244
|
+
- **port** Optional. The target port. Defaults to `5555`.
|
|
245
|
+
- **callback(err, id)** Optional. Use this or the returned `Promise`.
|
|
246
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
247
|
+
- **id** The connected device ID. Can be used as `serial` in other commands.
|
|
248
|
+
- Returns: `Promise`
|
|
249
|
+
- Resolves with: `id` (see callback)
|
|
272
250
|
|
|
273
251
|
##### Example - switch to TCP mode and set up a forward for Chrome devtools
|
|
274
252
|
|
|
275
253
|
Note: be careful with using `client.listDevices()` together with `client.tcpip()` and other similar methods that modify the connection with ADB. You might have the same device twice in your device list (i.e. one device connected via both USB and TCP), which can cause havoc if run simultaneously.
|
|
276
254
|
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
.
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
.
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
.
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
console.log('Setup devtools on "%s"', id)
|
|
303
|
-
})
|
|
304
|
-
})
|
|
305
|
-
})
|
|
306
|
-
})
|
|
307
|
-
})
|
|
255
|
+
```typescript
|
|
256
|
+
import Bluebird from 'bluebird';
|
|
257
|
+
import Adb from '@devicefarmer/adbkit';
|
|
258
|
+
const client = Adb.createClient();
|
|
259
|
+
|
|
260
|
+
const test = async () => {
|
|
261
|
+
try {
|
|
262
|
+
const devices = await client.listDevices();
|
|
263
|
+
await Bluebird.map(devices, async (device) => {
|
|
264
|
+
const device = client.getDevice(device.id);
|
|
265
|
+
const port = await device.tcpip();
|
|
266
|
+
// Switching to TCP mode causes ADB to lose the device for a
|
|
267
|
+
// moment, so let's just wait till we get it back.
|
|
268
|
+
await device.waitForDevice();
|
|
269
|
+
const ip = await device.getDHCPIpAddress();
|
|
270
|
+
const deviceTCP = await client.connect(ip, port);
|
|
271
|
+
// It can take a moment for the connection to happen.
|
|
272
|
+
await deviceTCP.waitForDevice();
|
|
273
|
+
await deviceTCP.forward('tcp:9222', 'localabstract:chrome_devtools_remote');
|
|
274
|
+
console.log(`Setup devtools on "${id}"`);
|
|
275
|
+
});
|
|
276
|
+
} catch (err) {
|
|
277
|
+
console.error('Something went wrong:', err.stack);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
308
280
|
```
|
|
309
281
|
|
|
310
|
-
#### client.disconnect(host[, port]
|
|
282
|
+
#### client.disconnect(host[, port])
|
|
311
283
|
|
|
312
284
|
Disconnects from the given device, which should have been connected via `client.connect()` or just `adb connect <host>:<port>`.
|
|
313
285
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
-
|
|
318
|
-
-
|
|
319
|
-
|
|
320
|
-
|
|
286
|
+
- **host** The target host. Can also contain the port, in which case the port argument is not used and can be skipped. In other words you can just put the `id` you got from `client.connect()` here and it will be fine.
|
|
287
|
+
- **port** Optional. The target port. Defaults to `5555`.
|
|
288
|
+
- **callback(err, id)** Optional. Use this or the returned `Promise`.
|
|
289
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
290
|
+
- **id** The disconnected device ID. Will no longer be usable as a `serial` in other commands until you've connected again.
|
|
291
|
+
- Returns: `Promise`
|
|
292
|
+
- Resolves with: `id` (see callback)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
#### client.kill()
|
|
296
|
+
|
|
297
|
+
This kills the ADB server. Note that the next connection will attempt to start the server again when it's unable to connect.
|
|
298
|
+
- Returns: `Promise<true>`
|
|
299
|
+
- Resolves with: `true`
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
#### client.listDevices()
|
|
303
|
+
|
|
304
|
+
Gets the list of currently connected devices and emulators.
|
|
305
|
+
- Returns: `Promise<devices>` An array of device objects. The device objects are plain JavaScript objects with two properties: `id` and `type`.
|
|
306
|
+
- **id** The ID of the device. For real devices, this is usually the USB identifier.
|
|
307
|
+
- **type** The device type. Values include `'emulator'` for emulators, `'device'` for devices, and `'offline'` for offline devices. `'offline'` can occur for example during boot, in low-battery conditions or when the ADB connection has not yet been approved on the device.- Resolves with: `devices` (see callback)
|
|
308
|
+
|
|
309
|
+
#### client.listDevicesWithPaths()
|
|
310
|
+
|
|
311
|
+
Like `client.listDevices()`, but includes the "path" of every device.
|
|
312
|
+
- Returns: `Promise<devices>` An array of device objects. The device objects are plain JavaScript objects with the following properties:
|
|
313
|
+
- **id** See `client.listDevices()`.
|
|
314
|
+
- **type** See `client.listDevices()`.
|
|
315
|
+
- **path** The device path. This can be something like `usb:FD120000` for real devices.
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
#### client.trackDevices()
|
|
319
|
+
|
|
320
|
+
Gets a device tracker. Events will be emitted when devices are added, removed, or their type changes (i.e. to/from `offline`). Note that the same events will be emitted for the initially connected devices also, so that you don't need to use both `client.listDevices()` and `client.trackDevices()`.
|
|
321
|
+
|
|
322
|
+
Note that as the tracker will keep a connection open, you must call `tracker.end()` if you wish to stop tracking devices.
|
|
323
|
+
|
|
324
|
+
- **callback(err, tracker)** Optional. Use this or the returned `Promise`.
|
|
325
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
326
|
+
- **tracker** The device tracker, which is an [`EventEmitter`][node-events]. The following events are available:
|
|
327
|
+
- **add** **(device)** Emitted when a new device is connected, once per device. See `client.listDevices()` for details on the device object.
|
|
328
|
+
- **remove** **(device)** Emitted when a device is unplugged, once per device. This does not include `offline` devices, those devices are connected but unavailable to ADB. See `client.listDevices()` for details on the device object.
|
|
329
|
+
- **change** **(device)** Emitted when the `type` property of a device changes, once per device. The current value of `type` is the new value. This event usually occurs the type changes from `'device'` to `'offline'` or the other way around. See `client.listDevices()` for details on the device object and the `'offline'` type.
|
|
330
|
+
- **changeSet** **(changes)** Emitted once for all changes reported by ADB in a single run. Multiple changes can occur when, for example, a USB hub is connected/unplugged and the device list changes quickly. If you wish to process all changes at once, use this event instead of the once-per-device ones. Keep in mind that the other events will still be emitted, though.
|
|
331
|
+
- **changes** An object with the following properties always present:
|
|
332
|
+
- **added** An array of added device objects, each one as in the `add` event. Empty if none.
|
|
333
|
+
- **removed** An array of removed device objects, each one as in the `remove` event. Empty if none.
|
|
334
|
+
- **changed** An array of changed device objects, each one as in the `change` event. Empty if none.
|
|
335
|
+
- **end** Emitted when the underlying connection ends.
|
|
336
|
+
- **error** **(err)** Emitted if there's an error.
|
|
337
|
+
- Returns: `Promise`
|
|
338
|
+
- Resolves with: `tracker` (see callback)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
### DeviceClient
|
|
343
|
+
|
|
344
|
+
#### device.clear(pkg)
|
|
345
|
+
|
|
346
|
+
Deletes all data associated with a package from the device. This is roughly analogous to `adb shell pm clear <pkg>`.
|
|
347
|
+
|
|
348
|
+
- **pkg** The package name. This is NOT the APK.
|
|
349
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
350
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
351
|
+
- Returns: `Promise`
|
|
352
|
+
- Resolves with: `true`
|
|
353
|
+
|
|
321
354
|
|
|
322
|
-
####
|
|
355
|
+
#### device.forward(local, remote)
|
|
323
356
|
|
|
324
357
|
Forwards socket connections from the ADB server host (local) to the device (remote). This is analogous to `adb forward <local> <remote>`. It's important to note that if you are connected to a remote ADB server, the forward will be created on that host.
|
|
325
358
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
-
|
|
329
|
-
-
|
|
330
|
-
-
|
|
331
|
-
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
#### client.framebuffer(serial[, format][, callback])
|
|
359
|
+
- **local** A string representing the local endpoint on the ADB host. At time of writing, can be one of:
|
|
360
|
+
- `tcp:<port>`
|
|
361
|
+
- `localabstract:<unix domain socket name>`
|
|
362
|
+
- `localreserved:<unix domain socket name>`
|
|
363
|
+
- `localfilesystem:<unix domain socket name>`
|
|
364
|
+
- `dev:<character device name>`
|
|
365
|
+
- **remote** A string representing the remote endpoint on the device. At time of writing, can be one of:
|
|
366
|
+
- Any value accepted by the `local` argument
|
|
367
|
+
- `jdwp:<process pid>`
|
|
368
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
369
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
370
|
+
- Returns: `Promise`
|
|
371
|
+
- Resolves with: `true`
|
|
372
|
+
|
|
373
|
+
#### device.framebuffer([format])
|
|
342
374
|
|
|
343
375
|
Fetches the current **raw** framebuffer (i.e. what is visible on the screen) from the device, and optionally converts it into something more usable by using [GraphicsMagick][graphicsmagick]'s `gm` command, which must be available in `$PATH` if conversion is desired. Note that we don't bother supporting really old framebuffer formats such as RGB_565. If for some mysterious reason you happen to run into a `>=2.3` device that uses RGB_565, let us know.
|
|
344
376
|
|
|
345
377
|
Note that high-resolution devices can have quite massive framebuffers. For example, a device with a resolution of 1920x1080 and 32 bit colors would have a roughly 8MB (`1920*1080*4` byte) RGBA framebuffer. Empirical tests point to about 5MB/s bandwidth limit for the ADB USB connection, which means that it can take ~1.6 seconds for the raw data to arrive, or even more if the USB connection is already congested. Using a conversion will further slow down completion.
|
|
346
378
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
#### client.getDevicePath(serial[, callback])
|
|
379
|
+
- **format** The desired output format. Any output format supported by [GraphicsMagick][graphicsmagick] (such as `'png'`) is supported. Defaults to `'raw'` for raw framebuffer data.
|
|
380
|
+
- **callback(err, framebuffer)** Optional. Use this or the returned `Promise`.
|
|
381
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
382
|
+
- **framebuffer** The possibly converted framebuffer stream. The stream also has a `meta` property with the following values:
|
|
383
|
+
- **version** The framebuffer version. Useful for patching possible backwards-compatibility issues.
|
|
384
|
+
- **bpp** Bits per pixel (i.e. color depth).
|
|
385
|
+
- **size** The raw byte size of the framebuffer.
|
|
386
|
+
- **width** The horizontal resolution of the framebuffer. This SHOULD always be the same as screen width. We have not encountered any device with incorrect framebuffer metadata, but according to rumors there might be some.
|
|
387
|
+
- **height** The vertical resolution of the framebuffer. This SHOULD always be the same as screen height.
|
|
388
|
+
- **red_offset** The bit offset of the red color in a pixel.
|
|
389
|
+
- **red_length** The bit length of the red color in a pixel.
|
|
390
|
+
- **blue_offset** The bit offset of the blue color in a pixel.
|
|
391
|
+
- **blue_length** The bit length of the blue color in a pixel.
|
|
392
|
+
- **green_offset** The bit offset of the green color in a pixel.
|
|
393
|
+
- **green_length** The bit length of the green color in a pixel.
|
|
394
|
+
- **alpha_offset** The bit offset of alpha in a pixel.
|
|
395
|
+
- **alpha_length** The bit length of alpha in a pixel. `0` when not available.
|
|
396
|
+
- **format** The framebuffer format for convenience. This can be one of `'bgr'`, `'bgra'`, `'rgb'`, `'rgba'`.
|
|
397
|
+
- Returns: `Promise`
|
|
398
|
+
- Resolves with: `framebuffer` (see callback)
|
|
399
|
+
|
|
400
|
+
#### device.getDevicePath()
|
|
370
401
|
|
|
371
402
|
Gets the device path of the device identified by the given serial number.
|
|
372
403
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
* Resolves with: `path` (see callback)
|
|
404
|
+
- **callback(err, path)** Optional. Use this or the returned `Promise`.
|
|
405
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
406
|
+
- **path** The device path. This corresponds to the device path in `client.listDevicesWithPaths()`.
|
|
407
|
+
- Returns: `Promise`
|
|
408
|
+
- Resolves with: `path` (see callback)
|
|
379
409
|
|
|
380
|
-
####
|
|
410
|
+
#### device.getDHCPIpAddress([iface])
|
|
381
411
|
|
|
382
412
|
Attemps to retrieve the IP address of the device. Roughly analogous to `adb shell getprop dhcp.<iface>.ipaddress`.
|
|
383
413
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
* Resolves with: `ip` (see callback)
|
|
414
|
+
- **iface** Optional. The network interface. Defaults to `'wlan0'`.
|
|
415
|
+
- **callback(err, ip)** Optional. Use this or the returned `Promise`.
|
|
416
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
417
|
+
- **ip** The IP address as a `String`.
|
|
418
|
+
- Returns: `Promise`
|
|
419
|
+
- Resolves with: `ip` (see callback)
|
|
391
420
|
|
|
392
|
-
####
|
|
421
|
+
#### device.getFeatures()
|
|
393
422
|
|
|
394
423
|
Retrieves the features of the device identified by the given serial number. This is analogous to `adb shell pm list features`. Useful for checking whether hardware features such as NFC are available (you'd check for `'android.hardware.nfc'`).
|
|
395
424
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
425
|
+
**flags** Flags to pass to the `pm list packages` command to filter the list
|
|
426
|
+
```
|
|
427
|
+
-d: filter to only show disabled packages
|
|
428
|
+
-e: filter to only show enabled packages
|
|
429
|
+
-s: filter to only show system packages
|
|
430
|
+
-3: filter to only show third party packages
|
|
431
|
+
```
|
|
432
|
+
- **callback(err, features)** Optional. Use this or the returned `Promise`.
|
|
433
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
434
|
+
- **features** An object of device features. Each key corresponds to a device feature, with the value being either `true` for a boolean feature, or the feature value as a string (e.g. `'0x20000'` for `reqGlEsVersion`).
|
|
435
|
+
- Returns: `Promise`
|
|
436
|
+
- Resolves with: `features` (see callback)
|
|
437
|
+
|
|
438
|
+
#### device.getPackages()
|
|
404
439
|
|
|
405
440
|
Retrieves the list of packages present on the device. This is analogous to `adb shell pm list packages`. If you just want to see if something's installed, consider using `client.isInstalled()` instead.
|
|
406
441
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
* Resolves with: `packages` (see callback)
|
|
442
|
+
- **callback(err, packages)** Optional. Use this or the returned `Promise`.
|
|
443
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
444
|
+
- **packages** An array of package names.
|
|
445
|
+
- Returns: `Promise`
|
|
446
|
+
- Resolves with: `packages` (see callback)
|
|
413
447
|
|
|
414
|
-
####
|
|
448
|
+
#### device.getProperties()
|
|
415
449
|
|
|
416
450
|
Retrieves the properties of the device identified by the given serial number. This is analogous to `adb shell getprop`.
|
|
417
451
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
* Resolves with: `properties` (see callback)
|
|
452
|
+
- **callback(err, properties)** Optional. Use this or the returned `Promise`.
|
|
453
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
454
|
+
- **properties** An object of device properties. Each key corresponds to a device property. Convenient for accessing things like `'ro.product.model'`.
|
|
455
|
+
- Returns: `Promise`
|
|
456
|
+
- Resolves with: `properties` (see callback)
|
|
424
457
|
|
|
425
|
-
####
|
|
458
|
+
#### device.getSerialNo()
|
|
426
459
|
|
|
427
460
|
Gets the serial number of the device identified by the given serial number. With our API this doesn't really make much sense, but it has been implemented for completeness. _FYI: in the raw ADB protocol you can specify a device in other ways, too._
|
|
428
461
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
* Resolves with: `serial` (see callback)
|
|
462
|
+
- **callback(err, serial)** Optional. Use this or the returned `Promise`.
|
|
463
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
464
|
+
- **serial** The serial number of the device.
|
|
465
|
+
- Returns: `Promise`
|
|
466
|
+
- Resolves with: `serial` (see callback)
|
|
435
467
|
|
|
436
|
-
####
|
|
468
|
+
#### device.getState()
|
|
437
469
|
|
|
438
470
|
Gets the state of the device identified by the given serial number.
|
|
439
471
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
* Resolves with: `state` (see callback)
|
|
472
|
+
- **callback(err, state)** Optional. Use this or the returned `Promise`.
|
|
473
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
474
|
+
- **state** The device state. This corresponds to the device type in `client.listDevices()`.
|
|
475
|
+
- Returns: `Promise`
|
|
476
|
+
- Resolves with: `state` (see callback)
|
|
446
477
|
|
|
447
|
-
####
|
|
478
|
+
#### device.install(apk)
|
|
448
479
|
|
|
449
480
|
Installs the APK on the device, replacing any previously installed version. This is roughly analogous to `adb install -r <apk>`.
|
|
450
481
|
|
|
451
482
|
Note that if the call seems to stall, you may have to accept a dialog on the phone first.
|
|
452
483
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
* Resolves with: `true`
|
|
484
|
+
- **apk** When `String`, interpreted as a path to an APK file. When [`Stream`][node-stream], installs directly from the stream, which must be a valid APK.
|
|
485
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
486
|
+
- **err** `null` when successful, `Error` otherwise. It may have a `.code` property containing the error code reported by the device.
|
|
487
|
+
- Returns: `Promise`
|
|
488
|
+
- Resolves with: `true`
|
|
459
489
|
|
|
460
490
|
##### Example - install an APK from a URL
|
|
461
491
|
|
|
462
492
|
This example requires the [request](https://www.npmjs.org/package/request) module. It also doesn't do any error handling (404 responses, timeouts, invalid URLs etc).
|
|
463
493
|
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
494
|
+
```typescript
|
|
495
|
+
import Adb from '@devicefarmer/adbkit';
|
|
496
|
+
import request from 'request';
|
|
497
|
+
import { Readable } from 'stream';
|
|
468
498
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
499
|
+
const client = Adb.createClient();
|
|
500
|
+
|
|
501
|
+
const test = async () => {
|
|
502
|
+
// The request module implements old-style streams, so we have to wrap it.
|
|
503
|
+
try {
|
|
504
|
+
// request is deprecated
|
|
505
|
+
const device = client.getClient('<serial>');
|
|
506
|
+
await device.install(new Readable().wrap(request('http://example.org/app.apk') as any) as any)
|
|
472
507
|
console.log('Installed')
|
|
473
|
-
})
|
|
508
|
+
} catch (err) {
|
|
509
|
+
console.error('Something went wrong:', err.stack)
|
|
510
|
+
}
|
|
511
|
+
}
|
|
474
512
|
```
|
|
475
513
|
|
|
476
|
-
####
|
|
514
|
+
#### device.installRemote(apk)
|
|
477
515
|
|
|
478
516
|
Installs an APK file which must already be located on the device file system, and replaces any previously installed version. Useful if you've previously pushed the file to the device for some reason (perhaps to have direct access to `client.push()`'s transfer stats). This is roughly analogous to `adb shell pm install -r <apk>` followed by `adb shell rm -f <apk>`.
|
|
479
517
|
|
|
480
518
|
Note that if the call seems to stall, you may have to accept a dialog on the phone first.
|
|
481
519
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
* Resolves with: `true`
|
|
520
|
+
- **apk** The path to the APK file on the device. The file will be removed when the command completes.
|
|
521
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
522
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
523
|
+
- Returns: `Promise`
|
|
524
|
+
- Resolves with: `true`
|
|
488
525
|
|
|
489
|
-
####
|
|
526
|
+
#### device.isInstalled(pkg)
|
|
490
527
|
|
|
491
528
|
Tells you if the specific package is installed or not. This is analogous to `adb shell pm path <pkg>` and some output parsing.
|
|
492
529
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
* Resolves with: `installed` (see callback)
|
|
500
|
-
|
|
501
|
-
#### client.kill([callback])
|
|
502
|
-
|
|
503
|
-
This kills the ADB server. Note that the next connection will attempt to start the server again when it's unable to connect.
|
|
504
|
-
|
|
505
|
-
* **callback(err)** Optional. Use this or the returned `Promise`.
|
|
506
|
-
- **err** `null` when successful, `Error` otherwise.
|
|
507
|
-
* Returns: `Promise`
|
|
508
|
-
* Resolves with: `true`
|
|
509
|
-
|
|
510
|
-
#### client.listDevices([callback])
|
|
511
|
-
|
|
512
|
-
Gets the list of currently connected devices and emulators.
|
|
513
|
-
|
|
514
|
-
* **callback(err, devices)** Optional. Use this or the returned `Promise`.
|
|
515
|
-
- **err** `null` when successful, `Error` otherwise.
|
|
516
|
-
- **devices** An array of device objects. The device objects are plain JavaScript objects with two properties: `id` and `type`.
|
|
517
|
-
* **id** The ID of the device. For real devices, this is usually the USB identifier.
|
|
518
|
-
* **type** The device type. Values include `'emulator'` for emulators, `'device'` for devices, and `'offline'` for offline devices. `'offline'` can occur for example during boot, in low-battery conditions or when the ADB connection has not yet been approved on the device.
|
|
519
|
-
* Returns: `Promise`
|
|
520
|
-
* Resolves with: `devices` (see callback)
|
|
521
|
-
|
|
522
|
-
#### client.listDevicesWithPaths([callback])
|
|
523
|
-
|
|
524
|
-
Like `client.listDevices()`, but includes the "path" of every device.
|
|
525
|
-
|
|
526
|
-
* **callback(err, devices)** Optional. Use this or the returned `Promise`.
|
|
527
|
-
- **err** `null` when successful, `Error` otherwise.
|
|
528
|
-
- **devices** An array of device objects. The device objects are plain JavaScript objects with the following properties:
|
|
529
|
-
* **id** See `client.listDevices()`.
|
|
530
|
-
* **type** See `client.listDevices()`.
|
|
531
|
-
* **path** The device path. This can be something like `usb:FD120000` for real devices.
|
|
532
|
-
* Returns: `Promise`
|
|
533
|
-
* Resolves with: `devices` (see callback)
|
|
530
|
+
- **pkg** The package name. This is NOT the APK.
|
|
531
|
+
- **callback(err, installed)** Optional. Use this or the returned `Promise`.
|
|
532
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
533
|
+
- **installed** `true` if the package is installed, `false` otherwise.
|
|
534
|
+
- Returns: `Promise`
|
|
535
|
+
- Resolves with: `installed` (see callback)
|
|
534
536
|
|
|
535
|
-
####
|
|
537
|
+
#### device.listForwards()
|
|
536
538
|
|
|
537
539
|
Lists forwarded connections on the device. This is analogous to `adb forward --list`.
|
|
538
540
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
* Resolves with: `forwards` (see callback)
|
|
541
|
+
- **callback(err, forwards)** Optional. Use this or the returned `Promise`.
|
|
542
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
543
|
+
- **forwards** An array of forward objects with the following properties:
|
|
544
|
+
- **serial** The device serial.
|
|
545
|
+
- **local** The local endpoint. Same format as `client.forward()`'s `local` argument.
|
|
546
|
+
- **remote** The remote endpoint on the device. Same format as `client.forward()`'s `remote` argument.
|
|
547
|
+
- Returns: `Promise`
|
|
548
|
+
- Resolves with: `forwards` (see callback)
|
|
548
549
|
|
|
549
|
-
####
|
|
550
|
+
#### device.listReverses()
|
|
550
551
|
|
|
551
552
|
Lists forwarded connections on the device. This is analogous to `adb reverse --list`.
|
|
552
553
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
-
|
|
556
|
-
-
|
|
557
|
-
|
|
558
|
-
|
|
554
|
+
- **callback(err, forwards)** Optional. Use this or the returned `Promise`.
|
|
555
|
+
|
|
556
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
557
|
+
- **reverses** An array of reverse objects with the following properties:
|
|
558
|
+
- **remote** The remote endpoint on the device. Same format as `client.reverse()`'s `remote` argument.
|
|
559
|
+
- **local** The local endpoint on the host. Same format as `client.reverse()`'s `local` argument.
|
|
559
560
|
|
|
560
|
-
|
|
561
|
-
|
|
561
|
+
- Returns: `Promise`
|
|
562
|
+
- Resolves with: `reverses` (see callback)
|
|
562
563
|
|
|
563
|
-
####
|
|
564
|
+
#### device.openLocal(path)
|
|
564
565
|
|
|
565
566
|
Opens a direct connection to a unix domain socket in the given path.
|
|
566
567
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
* Resolves with: `conn` (see callback)
|
|
568
|
+
- **path** The path to the socket. Prefixed with `'localfilesystem:'` by default, include another prefix (e.g. `'localabstract:'`) in the path to override.
|
|
569
|
+
- **callback(err, conn)** Optional. Use this or the returned `Promise`.
|
|
570
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
571
|
+
- **conn** The connection (i.e. [`net.Socket`][node-net]). Read and write as you please. Call `conn.end()` to end the connection.
|
|
572
|
+
- Returns: `Promise`
|
|
573
|
+
- Resolves with: `conn` (see callback)
|
|
574
574
|
|
|
575
|
-
####
|
|
575
|
+
#### device.openLog(name)
|
|
576
576
|
|
|
577
577
|
Opens a direct connection to a binary log file, providing access to the raw log data. Note that it is usually much more convenient to use the `client.openLogcat()` method, described separately.
|
|
578
578
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
* Resolves with: `log` (see callback)
|
|
579
|
+
- **name** The name of the log. Available logs include `'main'`, `'system'`, `'radio'` and `'events'`.
|
|
580
|
+
- **callback(err, log)** Optional. Use this or the returned `Promise`.
|
|
581
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
582
|
+
- **log** The binary log stream. Call `log.end()` when you wish to stop receiving data.
|
|
583
|
+
- Returns: `Promise`
|
|
584
|
+
- Resolves with: `log` (see callback)
|
|
586
585
|
|
|
587
|
-
####
|
|
586
|
+
#### device.openLogcat([options])
|
|
588
587
|
|
|
589
588
|
Calls the `logcat` utility on the device and hands off the connection to [adbkit-logcat][adbkit-logcat], a pure Node.js Logcat client. This is analogous to `adb logcat -B`, but the event stream will be parsed for you and a separate event will be emitted for every log entry, allowing for easy processing.
|
|
590
589
|
|
|
591
590
|
For more information, check out the [adbkit-logcat][adbkit-logcat] documentation.
|
|
592
591
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
* Resolves with: `logcat` (see callback)
|
|
592
|
+
- **options** Optional. The following options are supported:
|
|
593
|
+
- **clear** When `true`, clears logcat before opening the reader. Not set by default.
|
|
594
|
+
- **callback(err, logcat)** Optional. Use this or the returned `Promise`.
|
|
595
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
596
|
+
- **logcat** The Logcat client. Please see the [adbkit-logcat][adbkit-logcat] documentation for details.
|
|
597
|
+
- Returns: `Promise`
|
|
598
|
+
- Resolves with: `logcat` (see callback)
|
|
601
599
|
|
|
602
|
-
####
|
|
600
|
+
#### device.openMonkey([port])
|
|
603
601
|
|
|
604
602
|
Starts the built-in `monkey` utility on the device, connects to it using `client.openTcp()` and hands the connection to [adbkit-monkey][adbkit-monkey], a pure Node.js Monkey client. This allows you to create touch and key events, among other things.
|
|
605
603
|
|
|
606
604
|
For more information, check out the [adbkit-monkey][adbkit-monkey] documentation.
|
|
607
605
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
* Resolves with: `monkey` (see callback)
|
|
606
|
+
- **port** Optional. The device port where you'd like Monkey to run at. Defaults to `1080`.
|
|
607
|
+
- **callback(err, monkey)** Optional. Use this or the returned `Promise`.
|
|
608
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
609
|
+
- **monkey** The Monkey client. Please see the [adbkit-monkey][adbkit-monkey] documentation for details.
|
|
610
|
+
- Returns: `Promise`
|
|
611
|
+
- Resolves with: `monkey` (see callback)
|
|
615
612
|
|
|
616
|
-
####
|
|
613
|
+
#### device.openProcStat()
|
|
617
614
|
|
|
618
615
|
Tracks `/proc/stat` and emits useful information, such as CPU load. A single sync service instance is used to download the `/proc/stat` file for processing. While doing this does consume some resources, it is very light and should not be a problem.
|
|
619
616
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
#### client.openTcp(serial, port[, host][, callback])
|
|
617
|
+
- **callback(err, stats)** Optional. Use this or the returned `Promise`.
|
|
618
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
619
|
+
- **stats** The `/proc/stat` tracker, which is an [`EventEmitter`][node-events]. Call `stat.end()` to stop tracking. The following events are available:
|
|
620
|
+
- **load** **(loads)** Emitted when a CPU load calculation is available.
|
|
621
|
+
- **loads** CPU loads of **online** CPUs. Each key is a CPU id (e.g. `'cpu0'`, `'cpu1'`) and the value an object with the following properties:
|
|
622
|
+
- **user** Percentage (0-100) of ticks spent on user programs.
|
|
623
|
+
- **nice** Percentage (0-100) of ticks spent on `nice`d user programs.
|
|
624
|
+
- **system** Percentage (0-100) of ticks spent on system programs.
|
|
625
|
+
- **idle** Percentage (0-100) of ticks spent idling.
|
|
626
|
+
- **iowait** Percentage (0-100) of ticks spent waiting for IO.
|
|
627
|
+
- **irq** Percentage (0-100) of ticks spent on hardware interrupts.
|
|
628
|
+
- **softirq** Percentage (0-100) of ticks spent on software interrupts.
|
|
629
|
+
- **steal** Percentage (0-100) of ticks stolen by others.
|
|
630
|
+
- **guest** Percentage (0-100) of ticks spent by a guest.
|
|
631
|
+
- **guestnice** Percentage (0-100) of ticks spent by a `nice`d guest.
|
|
632
|
+
- **total** Total. Always 100.
|
|
633
|
+
- Returns: `Promise`
|
|
634
|
+
- Resolves with: `stats` (see callback)
|
|
635
|
+
|
|
636
|
+
#### device.openTcp(port[, host])
|
|
641
637
|
|
|
642
638
|
Opens a direct TCP connection to a port on the device, without any port forwarding required.
|
|
643
639
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
* Resolves with: `conn` (see callback)
|
|
640
|
+
- **port** The port number to connect to.
|
|
641
|
+
- **host** Optional. The host to connect to. Allegedly this is supposed to establish a connection to the given host from the device, but we have not been able to get it to work at all. Skip the host and everything works great.
|
|
642
|
+
- **callback(err, conn)** Optional. Use this or the returned `Promise`.
|
|
643
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
644
|
+
- **conn** The TCP connection (i.e. [`net.Socket`][node-net]). Read and write as you please. Call `conn.end()` to end the connection.
|
|
645
|
+
- Returns: `Promise`
|
|
646
|
+
- Resolves with: `conn` (see callback)
|
|
652
647
|
|
|
653
|
-
####
|
|
648
|
+
#### device.pull(path)
|
|
654
649
|
|
|
655
650
|
A convenience shortcut for `sync.pull()`, mainly for one-off use cases. The connection cannot be reused, resulting in poorer performance over multiple calls. However, the Sync client will be closed automatically for you, so that's one less thing to worry about.
|
|
656
651
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
* Resolves with: `transfer` (see callback)
|
|
652
|
+
- **path** See `sync.pull()` for details.
|
|
653
|
+
- **callback(err, transfer)** Optional. Use this or the returned `Promise`.
|
|
654
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
655
|
+
- **transfer** A `PullTransfer` instance (see below)
|
|
656
|
+
- Returns: `Promise`
|
|
657
|
+
- Resolves with: `transfer` (see callback)
|
|
664
658
|
|
|
665
|
-
####
|
|
659
|
+
#### device.push(contents, path[, mode])
|
|
666
660
|
|
|
667
661
|
A convenience shortcut for `sync.push()`, mainly for one-off use cases. The connection cannot be reused, resulting in poorer performance over multiple calls. However, the Sync client will be closed automatically for you, so that's one less thing to worry about.
|
|
668
662
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
* Resolves with: `transfer` (see callback)
|
|
663
|
+
- **contents** See `sync.push()` for details.
|
|
664
|
+
- **path** See `sync.push()` for details.
|
|
665
|
+
- **mode** See `sync.push()` for details.
|
|
666
|
+
- **callback(err, transfer)** Optional. Use this or the returned `Promise`.
|
|
667
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
668
|
+
- **transfer** A `PushTransfer` instance (see below)
|
|
669
|
+
- Returns: `Promise`
|
|
670
|
+
- Resolves with: `transfer` (see callback)
|
|
678
671
|
|
|
679
|
-
####
|
|
672
|
+
#### device.readdir(path)
|
|
680
673
|
|
|
681
674
|
A convenience shortcut for `sync.readdir()`, mainly for one-off use cases. The connection cannot be reused, resulting in poorer performance over multiple calls. However, the Sync client will be closed automatically for you, so that's one less thing to worry about.
|
|
682
675
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
* Resolves with: See `sync.readdir()` for details.
|
|
676
|
+
- **path** See `sync.readdir()` for details.
|
|
677
|
+
- **callback(err, files)** Optional. Use this or the returned `Promise`. See `sync.readdir()` for details.
|
|
678
|
+
- Returns: `Promise`
|
|
679
|
+
- Resolves with: See `sync.readdir()` for details.
|
|
688
680
|
|
|
689
|
-
####
|
|
681
|
+
#### device.reboot()
|
|
690
682
|
|
|
691
683
|
Reboots the device. Similar to `adb reboot`. Note that the method resolves when ADB reports that the device has been rebooted (i.e. the reboot command was successful), not when the device becomes available again.
|
|
692
684
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
* Resolves with: `true`
|
|
685
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
686
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
687
|
+
- Returns: `Promise`
|
|
688
|
+
- Resolves with: `true`
|
|
698
689
|
|
|
699
|
-
####
|
|
690
|
+
#### device.remount()
|
|
700
691
|
|
|
701
692
|
Attempts to remount the `/system` partition in read-write mode. This will usually only work on emulators and developer devices.
|
|
702
693
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
* Resolves with: `true`
|
|
694
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
695
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
696
|
+
- Returns: `Promise`
|
|
697
|
+
- Resolves with: `true`
|
|
708
698
|
|
|
709
|
-
####
|
|
699
|
+
#### device.reverse(remote, local)
|
|
710
700
|
|
|
711
701
|
Reverses socket connections from the device (remote) to the ADB server host (local). This is analogous to `adb reverse <remote> <local>`. It's important to note that if you are connected to a remote ADB server, the reverse will be created on that host.
|
|
712
702
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
-
|
|
716
|
-
-
|
|
717
|
-
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
* Resolves with: `true`
|
|
703
|
+
- **remote** A string representing the remote endpoint on the device. At time of writing, can be one of:
|
|
704
|
+
- `tcp:<port>`
|
|
705
|
+
- `localabstract:<unix domain socket name>`
|
|
706
|
+
- `localreserved:<unix domain socket name>`
|
|
707
|
+
- `localfilesystem:<unix domain socket name>`
|
|
708
|
+
- **local** A string representing the local endpoint on the ADB host. At time of writing, can be any value accepted by the `remote` argument.
|
|
709
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
710
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
711
|
+
- Returns: `Promise`
|
|
712
|
+
- Resolves with: `true`
|
|
724
713
|
|
|
725
|
-
####
|
|
714
|
+
#### device.root()
|
|
726
715
|
|
|
727
|
-
Puts the device into root mode which may be needed by certain shell commands.
|
|
716
|
+
Puts the device into root mode which may be needed by certain shell commands. A remount is generally required after a successful root call. **Note that this will only work if your device supports this feature. Production devices almost never do.**
|
|
728
717
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
* Resolves with: `true`
|
|
718
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
719
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
720
|
+
- Returns: `Promise`
|
|
721
|
+
- Resolves with: `true`
|
|
734
722
|
|
|
735
|
-
####
|
|
723
|
+
#### device.screencap()
|
|
736
724
|
|
|
737
725
|
Takes a screenshot in PNG format using the built-in `screencap` utility. This is analogous to `adb shell screencap -p`. Sadly, the utility is not available on most Android `<=2.3` devices, but a silent fallback to the `client.framebuffer()` command in PNG mode is attempted, so you should have its dependencies installed just in case.
|
|
738
726
|
|
|
@@ -740,42 +728,84 @@ Generating the PNG on the device naturally requires considerably more processing
|
|
|
740
728
|
|
|
741
729
|
For convenience purposes, if the screencap command fails (e.g. because it doesn't exist on older Androids), we fall back to `client.framebuffer(serial, 'png')`, which is slower and has additional installation requirements.
|
|
742
730
|
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
* Resolves with: `screencap` (see callback)
|
|
731
|
+
- **callback(err, screencap)** Optional. Use this or the returned `Promise`.
|
|
732
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
733
|
+
- **screencap** The PNG stream.
|
|
734
|
+
- Returns: `Promise`
|
|
735
|
+
- Resolves with: `screencap` (see callback)
|
|
749
736
|
|
|
750
|
-
####
|
|
737
|
+
#### device.shell(command)
|
|
751
738
|
|
|
752
739
|
Runs a shell command on the device. Note that you'll be limited to the permissions of the `shell` user, which ADB uses.
|
|
753
740
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
* Resolves with: `output` (see callback)
|
|
741
|
+
- **command** The shell command to execute. When `String`, the command is run as-is. When `Array`, the elements will be rudimentarily escaped (for convenience, not security) and joined to form a command.
|
|
742
|
+
- **callback(err, conn)** Optional. Use this or the returned `Promise`.
|
|
743
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
744
|
+
- **conn** A readable stream (`Socket` actually) containing the progressive `stdout` of the command. Use with `adb.util.readAll` to get a readable String from it.
|
|
745
|
+
- Returns: `Promise`
|
|
746
|
+
- Resolves with: `conn` (see callback)
|
|
761
747
|
|
|
762
748
|
##### Example
|
|
763
749
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
750
|
+
* Read the output of an instantaneous command
|
|
751
|
+
```typescript
|
|
752
|
+
import Bluebird from 'bluebird';
|
|
753
|
+
import Adb from '@devicefarmer/adbkit';
|
|
754
|
+
|
|
755
|
+
const client = Adb.createClient();
|
|
756
|
+
|
|
757
|
+
client
|
|
758
|
+
.listDevices()
|
|
759
|
+
.then(function (devices) {
|
|
760
|
+
return Promise.map(devices, function (device) {
|
|
761
|
+
const device = client.getDevice(device.id);
|
|
762
|
+
return (
|
|
763
|
+
device
|
|
764
|
+
.shell('echo $RANDOM')
|
|
765
|
+
// Use the readAll() utility to read all the content without
|
|
766
|
+
// having to deal with the readable stream. `output` will be a Buffer
|
|
767
|
+
// containing all the output.
|
|
768
|
+
.then(adb.util.readAll)
|
|
769
|
+
.then(function (output) {
|
|
770
|
+
console.log('[%s] %s', device.id, output.toString().trim());
|
|
771
|
+
})
|
|
772
|
+
);
|
|
773
|
+
});
|
|
774
|
+
})
|
|
775
|
+
.then(function () {
|
|
776
|
+
console.log('Done.');
|
|
777
|
+
})
|
|
778
|
+
.catch(function (err) {
|
|
779
|
+
console.error('Something went wrong:', err.stack);
|
|
780
|
+
});
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
* Progressively read the output of a long-running command and terminate it
|
|
784
|
+
```typescript
|
|
785
|
+
import Bluebird from 'bluebird';
|
|
786
|
+
import Adb from '@devicefarmer/adbkit';
|
|
768
787
|
|
|
788
|
+
const client = Adb.createClient();
|
|
769
789
|
client.listDevices()
|
|
770
790
|
.then(function(devices) {
|
|
771
|
-
return
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
791
|
+
return Bluebird.map(devices, function(device) {
|
|
792
|
+
const device = client.getDevice(device.id);
|
|
793
|
+
return device.shell('logcat') // logcat just for illustration,
|
|
794
|
+
// prefer client.openLogcat in real use
|
|
795
|
+
.then(function(conn) {
|
|
796
|
+
var line = 0
|
|
797
|
+
conn.on('data', function(data) {
|
|
798
|
+
// here `ps` on the device shows the running logcat process
|
|
799
|
+
console.log(data.toString())
|
|
800
|
+
line += 1
|
|
801
|
+
// close the stream and the running process
|
|
802
|
+
// on the device will be gone, gracefully
|
|
803
|
+
if (line > 100) conn.end()
|
|
804
|
+
});
|
|
805
|
+
conn.on('close', function() {
|
|
806
|
+
// here `ps` on the device shows the logcat process is gone
|
|
807
|
+
console.log('100 lines read already, bye')
|
|
808
|
+
})
|
|
779
809
|
})
|
|
780
810
|
})
|
|
781
811
|
})
|
|
@@ -787,177 +817,138 @@ client.listDevices()
|
|
|
787
817
|
})
|
|
788
818
|
```
|
|
789
819
|
|
|
790
|
-
|
|
820
|
+
|
|
821
|
+
#### device.startActivity(options)
|
|
791
822
|
|
|
792
823
|
Starts the configured activity on the device. Roughly analogous to `adb shell am start <options>`.
|
|
793
824
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
-
|
|
797
|
-
-
|
|
798
|
-
-
|
|
799
|
-
-
|
|
800
|
-
-
|
|
801
|
-
-
|
|
802
|
-
-
|
|
803
|
-
-
|
|
804
|
-
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
-
|
|
808
|
-
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
#### client.startService(serial, options[, callback])
|
|
825
|
+
- **options** The activity configuration. The following options are available:
|
|
826
|
+
- **debug** Set to `true` to enable debugging.
|
|
827
|
+
- **wait** Set to `true` to wait for the activity to launch.
|
|
828
|
+
- **user** The user to run as. Not set by default. If the option is unsupported by the device, an attempt will be made to run the same command again without the user option.
|
|
829
|
+
- **action** The action.
|
|
830
|
+
- **data** The data URI, if any.
|
|
831
|
+
- **mimeType** The mime type, if any.
|
|
832
|
+
- **category** The category. For multiple categories, pass an `Array`.
|
|
833
|
+
- **component** The component.
|
|
834
|
+
- **flags** Numeric flags.
|
|
835
|
+
- **extras** Any extra data.
|
|
836
|
+
- When an `Array`, each item must be an `Object` the following properties:
|
|
837
|
+
- **key** The key name.
|
|
838
|
+
- **type** The type, which can be one of `'string'`, `'null'`, `'bool'`, `'int'`, `'long'`, `'float'`, `'uri'`, `'component'`.
|
|
839
|
+
- **value** The value. Optional and unused if type is `'null'`. If an `Array`, type is automatically set to be an array of `<type>`.
|
|
840
|
+
- When an `Object`, each key is treated as the key name. Simple values like `null`, `String`, `Boolean` and `Number` are type-mapped automatically (`Number` maps to `'int'`) and can be used as-is. For more complex types, like arrays and URIs, set the value to be an `Object` like in the Array syntax (see above), but leave out the `key` property.
|
|
841
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
842
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
843
|
+
- Returns: `Promise`
|
|
844
|
+
- Resolves with: `true`
|
|
845
|
+
|
|
846
|
+
#### device.startService(options)
|
|
817
847
|
|
|
818
848
|
Starts the configured service on the device. Roughly analogous to `adb shell am startservice <options>`.
|
|
819
849
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
-
|
|
823
|
-
-
|
|
824
|
-
-
|
|
825
|
-
-
|
|
826
|
-
-
|
|
827
|
-
-
|
|
828
|
-
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
#### client.stat(serial, path[, callback])
|
|
850
|
+
- **options** The service configuration. The following options are available:
|
|
851
|
+
- **user** The user to run as. Defaults to `0`. If the option is unsupported by the device, an attempt will be made to run the same command again without the user option.
|
|
852
|
+
- **action** See `client.startActivity()` for details.
|
|
853
|
+
- **data** See `client.startActivity()` for details.
|
|
854
|
+
- **mimeType** See `client.startActivity()` for details.
|
|
855
|
+
- **category** See `client.startActivity()` for details.
|
|
856
|
+
- **component** See `client.startActivity()` for details.
|
|
857
|
+
- **flags** See `client.startActivity()` for details.
|
|
858
|
+
- **extras** See `client.startActivity()` for details.
|
|
859
|
+
- Returns: `Promise`
|
|
860
|
+
- Resolves with: `true`
|
|
861
|
+
|
|
862
|
+
#### device.stat(path)
|
|
834
863
|
|
|
835
864
|
A convenience shortcut for `sync.stat()`, mainly for one-off use cases. The connection cannot be reused, resulting in poorer performance over multiple calls. However, the Sync client will be closed automatically for you, so that's one less thing to worry about.
|
|
836
865
|
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
* Resolves with: See `sync.stat()` for details.
|
|
866
|
+
- **path** See `sync.stat()` for details.
|
|
867
|
+
- **callback(err, stats)** Optional. Use this or the returned `Promise`. See `sync.stat()` for details.
|
|
868
|
+
- Returns: `Promise`
|
|
869
|
+
- Resolves with: See `sync.stat()` for details.
|
|
842
870
|
|
|
843
|
-
####
|
|
871
|
+
#### device.syncService()
|
|
844
872
|
|
|
845
873
|
Establishes a new Sync connection that can be used to push and pull files. This method provides the most freedom and the best performance for repeated use, but can be a bit cumbersome to use. For simple use cases, consider using `client.stat()`, `client.push()` and `client.pull()`.
|
|
846
874
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
* Resolves with: `sync` (see callback)
|
|
875
|
+
- **callback(err, sync)** Optional. Use this or the returned `Promise`.
|
|
876
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
877
|
+
- **sync** The Sync client. See below for details. Call `sync.end()` when done.
|
|
878
|
+
- Returns: `Promise`
|
|
879
|
+
- Resolves with: `sync` (see callback)
|
|
853
880
|
|
|
854
|
-
####
|
|
881
|
+
#### device.tcpip(port)
|
|
855
882
|
|
|
856
883
|
Puts the device's ADB daemon into tcp mode, allowing you to use `adb connect` or `client.connect()` to connect to it. Note that the device will still be visible to ADB as a regular USB-connected device until you unplug it. Same as `adb tcpip <port>`.
|
|
857
884
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
* Resolves with: `port` (see callback)
|
|
865
|
-
|
|
866
|
-
#### client.trackDevices([callback])
|
|
867
|
-
|
|
868
|
-
Gets a device tracker. Events will be emitted when devices are added, removed, or their type changes (i.e. to/from `offline`). Note that the same events will be emitted for the initially connected devices also, so that you don't need to use both `client.listDevices()` and `client.trackDevices()`.
|
|
885
|
+
- **port** Optional. The port the device should listen on. Defaults to `5555`.
|
|
886
|
+
- **callback(err, port)** Optional. Use this or the returned `Promise`.
|
|
887
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
888
|
+
- **port** The port the device started listening on.
|
|
889
|
+
- Returns: `Promise`
|
|
890
|
+
- Resolves with: `port` (see callback)
|
|
869
891
|
|
|
870
|
-
Note that as the tracker will keep a connection open, you must call `tracker.end()` if you wish to stop tracking devices.
|
|
871
892
|
|
|
872
|
-
|
|
873
|
-
- **err** `null` when successful, `Error` otherwise.
|
|
874
|
-
- **tracker** The device tracker, which is an [`EventEmitter`][node-events]. The following events are available:
|
|
875
|
-
* **add** **(device)** Emitted when a new device is connected, once per device. See `client.listDevices()` for details on the device object.
|
|
876
|
-
* **remove** **(device)** Emitted when a device is unplugged, once per device. This does not include `offline` devices, those devices are connected but unavailable to ADB. See `client.listDevices()` for details on the device object.
|
|
877
|
-
* **change** **(device)** Emitted when the `type` property of a device changes, once per device. The current value of `type` is the new value. This event usually occurs the type changes from `'device'` to `'offline'` or the other way around. See `client.listDevices()` for details on the device object and the `'offline'` type.
|
|
878
|
-
* **changeSet** **(changes)** Emitted once for all changes reported by ADB in a single run. Multiple changes can occur when, for example, a USB hub is connected/unplugged and the device list changes quickly. If you wish to process all changes at once, use this event instead of the once-per-device ones. Keep in mind that the other events will still be emitted, though.
|
|
879
|
-
- **changes** An object with the following properties always present:
|
|
880
|
-
* **added** An array of added device objects, each one as in the `add` event. Empty if none.
|
|
881
|
-
* **removed** An array of removed device objects, each one as in the `remove` event. Empty if none.
|
|
882
|
-
* **changed** An array of changed device objects, each one as in the `change` event. Empty if none.
|
|
883
|
-
* **end** Emitted when the underlying connection ends.
|
|
884
|
-
* **error** **(err)** Emitted if there's an error.
|
|
885
|
-
* Returns: `Promise`
|
|
886
|
-
* Resolves with: `tracker` (see callback)
|
|
887
|
-
|
|
888
|
-
#### client.trackJdwp(serial[, callback])
|
|
893
|
+
#### device.trackJdwp()
|
|
889
894
|
|
|
890
895
|
Starts a JDWP tracker for the given device.
|
|
891
896
|
|
|
892
897
|
Note that as the tracker will keep a connection open, you must call `tracker.end()` if you wish to stop tracking JDWP processes.
|
|
893
898
|
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
#### client.uninstall(serial, pkg[, callback])
|
|
899
|
+
- **callback(err, tracker)** Optional. Use this or the returned `Promise`.
|
|
900
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
901
|
+
- **tracker** The JDWP tracker, which is an [`EventEmitter`][node-events]. The following events are available:
|
|
902
|
+
- **add** **(pid)** Emitted when a new JDWP process becomes available, once per pid.
|
|
903
|
+
- **remove** **(pid)** Emitted when a JDWP process becomes unavailable, once per pid.
|
|
904
|
+
- **changeSet** **(changes, pids)** All changes in a single event.
|
|
905
|
+
- **changes** An object with the following properties always present:
|
|
906
|
+
- **added** An array of pids that were added. Empty if none.
|
|
907
|
+
- **removed** An array of pids that were removed. Empty if none.
|
|
908
|
+
- **pids** All currently active pids (including pids from previous runs).
|
|
909
|
+
- **end** Emitted when the underlying connection ends.
|
|
910
|
+
- **error** **(err)** Emitted if there's an error.
|
|
911
|
+
- Returns: `Promise`
|
|
912
|
+
- Resolves with: `tracker` (see callback)
|
|
913
|
+
|
|
914
|
+
#### device.uninstall(pkg)
|
|
911
915
|
|
|
912
916
|
Uninstalls the package from the device. This is roughly analogous to `adb uninstall <pkg>`.
|
|
913
917
|
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
* Resolves with: `true`
|
|
918
|
+
- **pkg** The package name. This is NOT the APK.
|
|
919
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
920
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
921
|
+
- Returns: `Promise`
|
|
922
|
+
- Resolves with: `true`
|
|
920
923
|
|
|
921
|
-
####
|
|
924
|
+
#### device.usb()
|
|
922
925
|
|
|
923
926
|
Puts the device's ADB daemon back into USB mode. Reverses `client.tcpip()`. Same as `adb usb`.
|
|
924
927
|
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
* Resolves with: `true`
|
|
930
|
-
|
|
931
|
-
#### client.version([callback])
|
|
932
|
-
|
|
933
|
-
Queries the ADB server for its version. This is mainly useful for backwards-compatibility purposes.
|
|
928
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
929
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
930
|
+
- Returns: `Promise`
|
|
931
|
+
- Resolves with: `true`
|
|
934
932
|
|
|
935
|
-
* **callback(err, version)** Optional. Use this or the returned `Promise`.
|
|
936
|
-
- **err** `null` when successful, `Error` otherwise.
|
|
937
|
-
- **version** The version of the ADB server.
|
|
938
|
-
* Returns: `Promise`
|
|
939
|
-
* Resolves with: `version` (see callback)
|
|
940
933
|
|
|
941
|
-
####
|
|
934
|
+
#### device.waitBootComplete()
|
|
942
935
|
|
|
943
936
|
Waits until the device has finished booting. Note that the device must already be seen by ADB. This is roughly analogous to periodically checking `adb shell getprop sys.boot_completed`.
|
|
944
937
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
* Resolves with: `true`
|
|
938
|
+
- **callback(err)** Optional. Use this or the returned `Promise`.
|
|
939
|
+
- **err** `null` if the device has completed booting, `Error` otherwise (can occur if the connection dies while checking).
|
|
940
|
+
- Returns: `Promise`
|
|
941
|
+
- Resolves with: `true`
|
|
950
942
|
|
|
951
|
-
####
|
|
943
|
+
#### device.waitForDevice()
|
|
952
944
|
|
|
953
945
|
Waits until ADB can see the device. Note that you must know the serial in advance. Other than that, works like `adb -s serial wait-for-device`. If you're planning on reacting to random devices being plugged in and out, consider using `client.trackDevices()` instead.
|
|
954
946
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
* Resolves with: `id` (see callback)
|
|
947
|
+
- **callback(err, id)** Optional. Use this or the returned `Promise`.
|
|
948
|
+
- **err** `null` if the device has completed booting, `Error` otherwise (can occur if the connection dies while checking).
|
|
949
|
+
- **id** The device ID. Can be useful for chaining.
|
|
950
|
+
- Returns: `Promise`
|
|
951
|
+
- Resolves with: `id` (see callback)
|
|
961
952
|
|
|
962
953
|
### Sync
|
|
963
954
|
|
|
@@ -965,77 +956,77 @@ Waits until ADB can see the device. Note that you must know the serial in advanc
|
|
|
965
956
|
|
|
966
957
|
Closes the Sync connection, allowing Node to quit (assuming nothing else is keeping it alive, of course).
|
|
967
958
|
|
|
968
|
-
|
|
959
|
+
- Returns: The sync instance.
|
|
969
960
|
|
|
970
961
|
#### sync.pull(path)
|
|
971
962
|
|
|
972
963
|
Pulls a file from the device as a `PullTransfer` [`Stream`][node-stream].
|
|
973
964
|
|
|
974
|
-
|
|
975
|
-
|
|
965
|
+
- **path** The path to pull from.
|
|
966
|
+
- Returns: A `PullTransfer` instance. See below for details.
|
|
976
967
|
|
|
977
968
|
#### sync.push(contents, path[, mode])
|
|
978
969
|
|
|
979
970
|
Attempts to identify `contents` and calls the appropriate `push*` method for it.
|
|
980
971
|
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
972
|
+
- **contents** When `String`, treated as a local file path and forwarded to `sync.pushFile()`. Otherwise, treated as a [`Stream`][node-stream] and forwarded to `sync.pushStream()`.
|
|
973
|
+
- **path** The path to push to.
|
|
974
|
+
- **mode** Optional. The mode of the file. Defaults to `0644`.
|
|
975
|
+
- Returns: A `PushTransfer` instance. See below for details.
|
|
985
976
|
|
|
986
977
|
#### sync.pushFile(file, path[, mode])
|
|
987
978
|
|
|
988
979
|
Pushes a local file to the given path. Note that the path must be writable by the ADB user (usually `shell`). When in doubt, use `'/data/local/tmp'` with an appropriate filename.
|
|
989
980
|
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
981
|
+
- **file** The local file path.
|
|
982
|
+
- **path** See `sync.push()` for details.
|
|
983
|
+
- **mode** See `sync.push()` for details.
|
|
984
|
+
- Returns: See `sync.push()` for details.
|
|
994
985
|
|
|
995
986
|
#### sync.pushStream(stream, path[, mode])
|
|
996
987
|
|
|
997
988
|
Pushes a [`Stream`][node-stream] to the given path. Note that the path must be writable by the ADB user (usually `shell`). When in doubt, use `'/data/local/tmp'` with an appropriate filename.
|
|
998
989
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
990
|
+
- **stream** The readable stream.
|
|
991
|
+
- **path** See `sync.push()` for details.
|
|
992
|
+
- **mode** See `sync.push()` for details.
|
|
993
|
+
- Returns: See `sync.push()` for details.
|
|
1003
994
|
|
|
1004
|
-
#### sync.readdir(path
|
|
995
|
+
#### sync.readdir(path)
|
|
1005
996
|
|
|
1006
997
|
Retrieves a list of directory entries (e.g. files) in the given path, not including the `.` and `..` entries, just like [`fs.readdir`][node-fs]. If given a non-directory path, no entries are returned.
|
|
1007
998
|
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
-
|
|
1011
|
-
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
999
|
+
- **path** The path.
|
|
1000
|
+
- **callback(err, files)** Optional. Use this or the returned `Promise`.
|
|
1001
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
1002
|
+
- **files** An `Array` of [`fs.Stats`][node-fs-stats]-compatible instances. While the `stats.is*` methods are available, only the following properties are supported (in addition to the `name` field which contains the filename):
|
|
1003
|
+
- **name** The filename.
|
|
1004
|
+
- **mode** The raw mode.
|
|
1005
|
+
- **size** The file size.
|
|
1006
|
+
- **mtime** The time of last modification as a `Date`.
|
|
1007
|
+
- Returns: `Promise`
|
|
1008
|
+
- Resolves with: `files` (see callback)
|
|
1018
1009
|
|
|
1019
|
-
#### sync.stat(path
|
|
1010
|
+
#### sync.stat(path)
|
|
1020
1011
|
|
|
1021
1012
|
Retrieves information about the given path.
|
|
1022
1013
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
-
|
|
1026
|
-
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1014
|
+
- **path** The path.
|
|
1015
|
+
- **callback(err, stats)** Optional. Use this or the returned `Promise`.
|
|
1016
|
+
- **err** `null` when successful, `Error` otherwise.
|
|
1017
|
+
- **stats** An [`fs.Stats`][node-fs-stats] instance. While the `stats.is*` methods are available, only the following properties are supported:
|
|
1018
|
+
- **mode** The raw mode.
|
|
1019
|
+
- **size** The file size.
|
|
1020
|
+
- **mtime** The time of last modification as a `Date`.
|
|
1021
|
+
- Returns: `Promise`
|
|
1022
|
+
- Resolves with: `stats` (see callback)
|
|
1032
1023
|
|
|
1033
1024
|
#### sync.tempFile(path)
|
|
1034
1025
|
|
|
1035
1026
|
A simple helper method for creating appropriate temporary filenames for pushing files. This is essentially the same as taking the basename of the file and appending it to `'/data/local/tmp/'`.
|
|
1036
1027
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1028
|
+
- **path** The path of the file.
|
|
1029
|
+
- Returns: An appropriate temporary file path.
|
|
1039
1030
|
|
|
1040
1031
|
### PushTransfer
|
|
1041
1032
|
|
|
@@ -1043,18 +1034,18 @@ A simple EventEmitter, mainly for keeping track of the progress.
|
|
|
1043
1034
|
|
|
1044
1035
|
List of events:
|
|
1045
1036
|
|
|
1046
|
-
|
|
1047
|
-
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
-
|
|
1051
|
-
|
|
1037
|
+
- **progress** **(stats)** Emitted when a chunk has been flushed to the ADB connection.
|
|
1038
|
+
- **stats** An object with the following stats about the transfer:
|
|
1039
|
+
- **bytesTransferred** The number of bytes transferred so far.
|
|
1040
|
+
- **error** **(err)** Emitted on error.
|
|
1041
|
+
- **err** An `Error`.
|
|
1042
|
+
- **end** Emitted when the transfer has successfully completed.
|
|
1052
1043
|
|
|
1053
1044
|
#### pushTransfer.cancel()
|
|
1054
1045
|
|
|
1055
1046
|
Cancels the transfer by ending both the stream that is being pushed and the sync connection. This will most likely end up creating a broken file on your device. **Use at your own risk.** Also note that you must create a new sync connection if you wish to continue using the sync service.
|
|
1056
1047
|
|
|
1057
|
-
|
|
1048
|
+
- Returns: The pushTransfer instance.
|
|
1058
1049
|
|
|
1059
1050
|
### PullTransfer
|
|
1060
1051
|
|
|
@@ -1062,18 +1053,18 @@ Cancels the transfer by ending both the stream that is being pushed and the sync
|
|
|
1062
1053
|
|
|
1063
1054
|
List of events:
|
|
1064
1055
|
|
|
1065
|
-
|
|
1066
|
-
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
-
|
|
1070
|
-
|
|
1056
|
+
- **progress** **(stats)** Emitted when a new chunk is received.
|
|
1057
|
+
- **stats** An object with the following stats about the transfer:
|
|
1058
|
+
- **bytesTransferred** The number of bytes transferred so far.
|
|
1059
|
+
- **error** **(err)** Emitted on error.
|
|
1060
|
+
- **err** An `Error`.
|
|
1061
|
+
- **end** Emitted when the transfer has successfully completed.
|
|
1071
1062
|
|
|
1072
1063
|
#### pullTransfer.cancel()
|
|
1073
1064
|
|
|
1074
1065
|
Cancels the transfer by ending the connection. Can be useful for reading endless streams of data, such as `/dev/urandom` or `/dev/zero`, perhaps for benchmarking use. Note that you must create a new sync connection if you wish to continue using the sync service.
|
|
1075
1066
|
|
|
1076
|
-
|
|
1067
|
+
- Returns: The pullTransfer instance.
|
|
1077
1068
|
|
|
1078
1069
|
# Incompatible changes in version 2.x
|
|
1079
1070
|
|
|
@@ -1091,11 +1082,11 @@ Test coverage was also massively improved, although we've still got ways to go.
|
|
|
1091
1082
|
|
|
1092
1083
|
## More information
|
|
1093
1084
|
|
|
1094
|
-
|
|
1095
|
-
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1085
|
+
- [Android Debug Bridge][adb-site]
|
|
1086
|
+
- [SERVICES.TXT][adb-services] (ADB socket protocol)
|
|
1087
|
+
- [Android ADB Protocols][adb-protocols] (a blog post explaining the protocol)
|
|
1088
|
+
- [adb.js][adb-js] (another Node.js ADB implementation)
|
|
1089
|
+
- [ADB Chrome extension][chrome-adb]
|
|
1099
1090
|
|
|
1100
1091
|
## Contributing
|
|
1101
1092
|
|
|
@@ -1107,25 +1098,24 @@ See [LICENSE](LICENSE).
|
|
|
1107
1098
|
|
|
1108
1099
|
Copyright © The OpenSTF Project. All Rights Reserved.
|
|
1109
1100
|
|
|
1110
|
-
[nodejs]:
|
|
1111
|
-
[
|
|
1112
|
-
[
|
|
1113
|
-
[adb-
|
|
1114
|
-
[adb-
|
|
1115
|
-
[adb-
|
|
1116
|
-
[
|
|
1117
|
-
[
|
|
1118
|
-
[
|
|
1119
|
-
[
|
|
1120
|
-
[
|
|
1121
|
-
[node-
|
|
1122
|
-
[node-
|
|
1123
|
-
[node-
|
|
1124
|
-
[node-
|
|
1125
|
-
[node-fs]:
|
|
1126
|
-
[node-
|
|
1127
|
-
[
|
|
1128
|
-
[
|
|
1129
|
-
[
|
|
1130
|
-
[adbkit-
|
|
1131
|
-
[adbkit-monkey]: <https://npmjs.org/package/adbkit-monkey>
|
|
1101
|
+
[nodejs]: http://nodejs.org/
|
|
1102
|
+
[npm]: https://npmjs.org/
|
|
1103
|
+
[adb-js]: https://github.com/flier/adb.js
|
|
1104
|
+
[adb-site]: http://developer.android.com/tools/help/adb.html
|
|
1105
|
+
[adb-services]: https://github.com/android/platform_system_core/blob/master/adb/SERVICES.TXT
|
|
1106
|
+
[adb-protocols]: http://blogs.kgsoft.co.uk/2013_03_15_prg.htm
|
|
1107
|
+
[file_sync_service.h]: https://github.com/android/platform_system_core/blob/master/adb/file_sync_service.h
|
|
1108
|
+
[chrome-adb]: https://chrome.google.com/webstore/detail/adb/dpngiggdglpdnjdoaefidgiigpemgage
|
|
1109
|
+
[node-debug]: https://npmjs.org/package/debug
|
|
1110
|
+
[net-connect]: http://nodejs.org/api/net.html#net_net_connect_options_connectionlistener
|
|
1111
|
+
[node-events]: http://nodejs.org/api/events.html
|
|
1112
|
+
[node-stream]: http://nodejs.org/api/stream.html
|
|
1113
|
+
[node-buffer]: http://nodejs.org/api/buffer.html
|
|
1114
|
+
[node-net]: http://nodejs.org/api/net.html
|
|
1115
|
+
[node-fs]: http://nodejs.org/api/fs.html
|
|
1116
|
+
[node-fs-stats]: http://nodejs.org/api/fs.html#fs_class_fs_stats
|
|
1117
|
+
[node-gm]: https://github.com/aheckmann/gm
|
|
1118
|
+
[graphicsmagick]: http://www.graphicsmagick.org/
|
|
1119
|
+
[imagemagick]: http://www.imagemagick.org/
|
|
1120
|
+
[adbkit-logcat]: https://npmjs.org/package/adbkit-logcat
|
|
1121
|
+
[adbkit-monkey]: https://npmjs.org/package/adbkit-monkey
|