Description
Open a file for reading and/or writing.
-
Requests must have at least READ or WRITE bit set in the Options field.
-
Use the SECURE bit (0x80) of the Options byte to upload a write-only file (one that cannot be downloaded or viewed). This is useful for protecting MicroPython source code on the device.
-
The SECURE bit is only valid when also setting the WRITE bit and either creating a new file (CREATE + EXCLUSIVE) or replacing an existing file (TRUNCATE).
Format
| Offset | Size | Frame Field | Description |
|---|---|---|---|
5 |
8-bit |
File System Command |
File Open - 0x01 |
6 |
16-bit |
Path ID |
See Get Path ID - 0x1C for a description |
8 |
8-bit |
Options |
Bitfield with the following values:
|
9-n |
8-bit |
File Name |
Pathname relative to Path ID. |
Success Response
| Offset | Size | Frame Field | Description |
|---|---|---|---|
5 |
8-bit |
File System Command |
File Open - 0x01 |
6 |
8-bit |
Status |
Success - 0x00 |
7 |
16-bit |
File Handle |
Value used to reference file in later requests. Expires and becomes invalid if not referenced for over 2 minutes. |
9 |
8-bit |
File Size |
File’s size or 0xFFFFFFFF if unknown. |