micropython_tail_lines
Read the last lines of a text file on a MicroPython board to inspect recent log or output content without transferring the whole file.
Instructions
MicroPython ボード上のテキストファイル末尾の数行を返す。
Args: path: 対象ファイルパス lines: 返却する最大行数 timeout: コード送信から Raw REPL 復帰完了までの全体タイムアウト秒数 encoding: テキストデコードに使うエンコーディング errors: テキストデコード時のエラー処理
Returns: ok: 読み出しに成功したら True path: 対象ファイルパス content: 返したテキスト line_count: 返した行数 truncated: 返せなかった先頭側の行があるとき True error: エラー時のメッセージ
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| lines | No | ||
| errors | No | strict | |
| timeout | No | ||
| encoding | No | utf-8 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| path | Yes | ||
| error | Yes | ||
| content | Yes | ||
| truncated | Yes | ||
| line_count | Yes |