# line-column-path

> Parse and stringify file paths with line and column like `unicorn.js:8:14`

Latest version **4.0.0** (published 2025-11-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install line-column-path
pnpm add line-column-path
yarn add line-column-path
bun add line-column-path
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2025-11-22 |
| First published | 2017-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 1 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 25 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | file, filepath, line, column, path, editor, position, parse, stringify, parsing, decode, encode, format |

## Links

- npm: https://www.npmjs.com/package/line-column-path
- Repository: https://github.com/sindresorhus/line-column-path
- Homepage: https://github.com/sindresorhus/line-column-path#readme
- Issues: https://github.com/sindresorhus/line-column-path/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/line-column-path

## Dependencies (1)

- [unicorn-magic](https://npm.io/package/unicorn-magic.md) ^0.4.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 4.0.0 (latest) — 2025-11-22
- 3.0.0 — 2021-08-10
- 2.0.0 — 2019-04-22
- 1.0.0 — 2017-05-04

## README

# line-column-path

> Parse and stringify file paths with line and column like `unicorn.js:8:14`

## Install

```sh
npm install line-column-path
```

## Usage

```js
import {parseLineColumnPath, stringifyLineColumnPath} from 'line-column-path';

const parsed = parseLineColumnPath('unicorn.js:8:14');
//=> {file: 'unicorn.js', line: 8, column: 14}

stringifyLineColumnPath(parsed);
//=> 'unicorn.js:8:14'
```

## API

### parseLineColumnPath(path)

#### path

Type: `string | URL | object`

The file path to parse.

Can also be an object that you want to validate and normalize.

### stringifyLineColumnPath(path, options?)

#### path

Type: `object`

Object with a `.file` property and optionally a `.line` and `.column` property.

#### options

Type: `object`

##### file

Type: `boolean`\
Default: `true`

Output the file path.

Setting this to `false` will result in `8:18` instead of `unicorn.js:8:14`.

##### column

Type: `boolean`\
Default: `true`

Output the column.

Setting this to `false` will result in `unicorn.js:8` instead of `unicorn.js:8:14`.

---
_Source: https://npm.io/package/line-column-path · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
