hmFS.open_asset(path, flag)
Open the file in the application assets directory.
Type
(path: string, flag: FLAG) => fileId
Parameters
path
| Description | Required | Type | Default |
|---|---|---|---|
| Mini Program's assets directory file name (relative path) | yes | string | - |
FLAG
| Optional Properties | Description |
|---|---|
| O_RDONLY | read-only |
| O_WRONLY | write-only |
| O_RDWR | read-write |
| O_APPEND | Append mode on |
| O_CREAT | If file does not exist, create and open |
| O_EXCL | Used in conjunction with O_CREAT. If it does not exist, create and open it, if it does exist, return an error. |
| O_TRUNC | If the file exists, the length is truncated to 0 |
fileId
| Description | Type |
|---|---|
| file handle | number |