Skip to content

Write File

Write content to a file. Currently only lightweight text content is supported; binary data is not supported.

Interface Description

Interface Type

writeSandboxFile

Parameters

ParameterTypeRequiredDescription
deviceIdstringDevice ID
filestringAbsolute file path (filePath)
contentstringContent to write (UTF-8 text)

Return Value

Returns on success:

javascript
true

Basic Usage

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)

Cooperation: try.catch@foxmail.com