# vscode-uri

> The URI implementation that is used by VS Code and its extensions

Latest version **3.2.0** (published 2026-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install vscode-uri
pnpm add vscode-uri
yarn add vscode-uri
bun add vscode-uri
```

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2026-08-24 |
| First published | 2016-06-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 200 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 261 |
| Author | Microsoft |
| Maintainers | microsoft1es, microsoft-oss-releases, alexandrudima, kaimaetzel, sbatten, lszomoru, vscode-bot |

## Links

- npm: https://www.npmjs.com/package/vscode-uri
- Repository: https://github.com/microsoft/vscode-uri
- Homepage: https://github.com/microsoft/vscode-uri#readme
- Issues: https://github.com/microsoft/vscode-uri/issues
- npm.io page: https://npm.io/package/vscode-uri

## Recent versions

- 3.2.0 (latest) — 2026-08-24
- 3.1.0 — 2025-02-04
- 3.0.8 — 2023-10-05
- 3.0.7 — 2022-12-13
- 3.0.6 — 2022-09-19
- 3.0.5 — 2022-09-16
- 3.0.4 — 2022-09-15
- 3.0.3 — 2021-12-21
- 3.0.2 — 2021-01-05
- 3.0.1 — 2020-12-18
- 3.0.0 — 2020-12-17
- 2.1.2 — 2020-05-26
- 2.1.1 — 2019-10-30
- 2.1.0 — 2019-10-24
- 2.0.3 — 2019-07-10
- … 18 more at https://npm.io/package/vscode-uri/versions

## README

## vscode-uri

[![Build Status](https://travis-ci.org/Microsoft/vscode-uri.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-uri)

This module contains the URI implementation that is used by VS Code and its extensions. 
It has support for parsing a string into `scheme`, `authority`, `path`, `query`, and
`fragment` URI components as defined in: http://tools.ietf.org/html/rfc3986

```
  foo://example.com:8042/over/there?name=ferret#nose
  \_/   \______________/\_________/ \_________/ \__/
   |           |            |            |        |
scheme     authority       path        query   fragment
   |   _____________________|__
  / \ /                        \
  urn:example:animal:ferret:nose
```

## Usage

```js
import { URI } from 'vscode-uri'

// parse an URI from string

let uri = URI.parse('https://code.visualstudio.com/docs/extensions/overview#frag')

assert.ok(uri.scheme === 'https');
assert.ok(uri.authority === 'code.visualstudio.com');
assert.ok(uri.path === '/docs/extensions/overview');
assert.ok(uri.query === '');
assert.ok(uri.fragment === 'frag');
assert.ok(uri.toString() === 'https://code.visualstudio.com/docs/extensions/overview#frag')


// create an URI from a fs path

let uri = URI.file('/users/me/c#-projects/');

assert.ok(uri.scheme === 'file');
assert.ok(uri.authority === '');
assert.ok(uri.path === '/users/me/c#-projects/');
assert.ok(uri.query === '');
assert.ok(uri.fragment === '');
assert.ok(uri.toString() === 'file:///users/me/c%23-projects/')
```

## Usage: Util

This module also exports a `Utils` package which is an extension, not part of `vscode.Uri`, and useful for path-math. There is: 

* `Utils.joinPath(URI, paths): URI`
* `Utils.resolvePath(URI, paths): URI`
* `Utils.dirname(URI): string`
* `Utils.basename(URI): string`
* `Utils.extname(URI): string`

All util use posix path-math as defined by the node.js path module. 


## Contributing

The source of this module is taken straight from the [vscode](https://github.com/microsoft/vscode)-sources and because of that issues and pull request should be created in that repository. Thanks and Happy Coding!

## Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

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