写入文件内容
向指定文件写入内容,暂只支持存储轻量级文本信息,不支持二进制。
接口说明
接口类型
writeSandboxFile参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
deviceId | string | ✅ | 设备 ID |
file | string | ✅ | 文件绝对路径(filePath) |
content | string | ✅ | 写入内容(UTF-8 文本) |
返回值
成功返回:
javascript
true基本使用
javascript
const _device = await apiInvoke('getDeviceInfo', {
deviceId: 'P72578581E07'
})
const _result = await apiInvoke('writeSandboxFile', {
deviceId: 'P72578581E07',
file: `${_device.info.sandboxPath}/hello.txt`,
content: 'hello sandbox'
})
console.log(_result)