This commit is contained in:
@@ -56,8 +56,12 @@ GUI です。ワークスペースの **「アプリ」タブ**に一覧表示
|
||||
```js
|
||||
// 読み取り
|
||||
window.parent.postMessage({ id, type: 'readFile', path: 'output/data.json' }, '*');
|
||||
// 安全な画像・PDF・音声・動画を表示する一時 URL(1ファイル10MBまで)
|
||||
window.parent.postMessage({ id, type: 'readFileUrl', path: 'output/chart.png' }, '*');
|
||||
// 一覧(dir 省略でワークスペース直下)
|
||||
window.parent.postMessage({ id, type: 'listFiles', dir: 'output' }, '*');
|
||||
// 再帰一覧(ファイルのみ、path順。最大1000件・深さ10、打ち切り時 truncated=true)
|
||||
window.parent.postMessage({ id, type: 'listFilesRecursive', dir: 'source' }, '*');
|
||||
// 書き込み(content は文字列)
|
||||
window.parent.postMessage({ id, type: 'writeFile', path: 'output/請求書.html', content: '<html>…' }, '*');
|
||||
// 削除(常に確認ダイアログが出る)
|
||||
@@ -79,7 +83,9 @@ window.addEventListener('message', (e) => {
|
||||
| type | 成功時 `data` |
|
||||
|-------------|-------------------------------------------------|
|
||||
| `readFile` | `{ path, content }`(content は UTF-8 テキスト)|
|
||||
| `readFileUrl` | `{ path, url, mime, bytes }`(表示用の一時 URL。HTML/SVG/未知形式は拒否)|
|
||||
| `listFiles` | `{ dir, entries }`(entries はファイル/フォルダ)|
|
||||
| `listFilesRecursive` | `{ dir, entries, truncated }`(entries はファイルのみ)|
|
||||
| `writeFile` | `{ path, bytes }` |
|
||||
| `deleteFile`| `{ deleted, skipped }` |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user