Read Directory
List files and folders under a given directory path. Each entry includes name, whether it is a directory, size, and last modified time.
Interface Description
Interface Type
readSandboxPathParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
deviceId | string | ✅ | Device ID |
path | string | ❌ | Target directory path (if omitted or empty, defaults to sandbox root, same as device.info.sandboxPath) |
Return Value
Returns an array:
javascript
[
{
name: "result.txt",
dir: false,
size: 1234,
mtime: 1710000000000
}
]Field notes:
name: entry name (no parent path)dir: whether entry is a directorysize: bytes (directories may be 0)mtime: last modified time (milliseconds timestamp)
Basic Usage
javascript
const _device = await apiInvoke('getDeviceInfo', {
deviceId: 'P72578581E07'
})
// Read sandbox root (default: omit path)
const _entries = await apiInvoke('readSandboxPath', {
deviceId: 'P72578581E07'
})
// Read sandbox root (explicit path)
const _entries = await apiInvoke('readSandboxPath', {
deviceId: 'P72578581E07',
path: _device.info.sandboxPath
})
console.log(_entries)