Truncate text from the start, preserving the end. Useful for file paths and URLs where the tail is most important.
The text to truncate
Maximum width in terminal cells
Truncated text with ellipsis at start, or original if it fits
truncateStart("/home/user/documents/project/src/index.ts", 20)// "…ject/src/index.ts" Copy
truncateStart("/home/user/documents/project/src/index.ts", 20)// "…ject/src/index.ts"
Truncate text from the start, preserving the end. Useful for file paths and URLs where the tail is most important.