sindresorhus/tildify

Convert an absolute path to tilde path: /Users/sindresorhus/dev => ~/dev

JavaScript

95

36 commits

updated Sep 18, 2026

See the code

README

tildify

Convert an absolute path to a tilde path: /Users/sindresorhus/dev → ~/dev

Install

$ npm install tildify

Usage

import tildify from 'tildify';

tildify('/Users/sindresorhus/dev');
//=> '~/dev'

See untildify for the inverse.