Skip to content

写入文件内容 ​

向指定文件写入内容,暂只支持存储轻量级文本信息,不支持二进制。

接口说明 ​

接口类型 ​

writeSandboxFile

参数 ​

参数名类型必填说明
deviceIdstring✅设备 ID
filestring✅文件绝对路径(filePath)
contentstring✅写入内容(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)

商务合作:try.catch@foxmail.com