Skip to main content
Version: v1.0

open

For an introduction to the Zepp OS Mini Program file system, please refer to File System.

Open the file in the /data directory of the Mini Program.

Type​

(path: string, flag: FLAG) => fileId

Parameters​

path​

DescriptionRequiredTypeDefault
Mini Program /data directory file name (relative path)yesstring-

FLAG​

Optional PropertiesDescription
O_RDONLYread-only
O_WRONLYwrite-only
O_RDWRread-write
O_APPENDAppend mode on.
O_CREATIf file does not exist, create and open.
O_EXCLUsed in conjunction with O_CREAT. If it does not exist, create and open it, if it does exist, return an error.
O_TRUNCIf the file exists, the length is truncated to 0.

fileId​

DescriptionType
file handlenumber

Usage​

Page({
build() {
const fileId = hmFS.open('test_file.txt', hmFS.O_RDWR | hmFS.O_CREAT)
}
})