(s: string)
| 74 | |
| 75 | /** Short, human label for a pasted blob, e.g. "Pasted 42 lines (1.2 KB)". */ |
| 76 | export function pasteLabel(s: string): string { |
| 77 | const lines = countLines(s); |
| 78 | const bytes = Buffer.byteLength(s, 'utf8'); |
| 79 | const size = bytes >= 1024 ? `${(bytes / 1024).toFixed(1)} KB` : `${bytes} B`; |
| 80 | const lineStr = lines === 1 ? '1 line' : `${lines} lines`; |
| 81 | return `Pasted ${lineStr} (${size})`; |
| 82 | } |
| 83 | |
| 84 | // ── Attachment chips (pasted blobs / images / dropped files & folders) ────────── |
| 85 | export interface Attachment { kind: 'paste' | 'image' | 'dir' | 'file'; label: string; payload: string; } |
no test coverage detected