Skip to main content
Version: v3

hmFS.open_asset(path, flag)

Open the file in the application assets directory.

Type

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

Parameters

path

DescriptionRequiredTypeDefault
Mini Program's assets 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