micropython_read_file
Read a file from a MicroPython board and return its content as text or base64, with options for encoding, error handling, and timeout.
Instructions
MicroPython ボードのファイルを読み出して返す
Args:
path: 読み出すファイルのパス (例: "/main.py")
timeout: コード送信から Raw REPL 復帰完了までの全体タイムアウト秒数
encoding: テキストデコードに使うエンコーディング
errors: テキストデコード時のエラー処理
as_base64: True のときは content を空にし、content_base64 に base64 を返す
Returns:
ok: 読み出しに成功したら True
path: 読み出したファイルパス
content: テキスト内容。as_base64=True のときは空文字列
content_base64: base64 内容。as_base64=False のときは None
size_bytes: 読み出したバイト数
error: エラー時のメッセージ
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| errors | No | strict | |
| timeout | No | ||
| encoding | No | utf-8 | |
| as_base64 | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| path | Yes | ||
| error | Yes | ||
| content | Yes | ||
| size_bytes | Yes | ||
| content_base64 | Yes |