Options
All
  • Public
  • Public/Protected
  • All
Menu

A universal resource identifier representing either a file on disk or another resource, like untitled resources.

Hierarchy

  • Uri

Index

Constructors

Private constructor

  • new Uri(scheme: string, authority: string, path: string, query: string, fragment: string): Uri
  • Use the file and parse factory functions to create new Uri objects.

    Parameters

    • scheme: string
    • authority: string
    • path: string
    • query: string
    • fragment: string

    Returns Uri

Properties

authority

authority: string

Authority is the www.msft.com part of http://www.msft.com/some/path?query#fragment. The part between the first double slashes and the next slash.

fragment

fragment: string

Fragment is the fragment part of http://www.msft.com/some/path?query#fragment.

fsPath

fsPath: string

The string representing the corresponding file system path of this Uri.

Will handle UNC paths and normalize windows drive letters to lower-case. Also uses the platform specific path separator. Will not validate the path for invalid characters and semantics. Will not look at the scheme of this Uri.

path

path: string

Path is the /some/path part of http://www.msft.com/some/path?query#fragment.

query

query: string

Query is the query part of http://www.msft.com/some/path?query#fragment.

scheme

scheme: string

Scheme is the http part of http://www.msft.com/some/path?query#fragment. The part before the first colon.

Methods

toJSON

  • toJSON(): any
  • Returns a JSON representation of this Uri.

    Returns any

    An object.

toString

  • toString(skipEncoding?: boolean): string
  • Returns a string representation of this Uri. The representation and normalization of a URI depends on the scheme. The resulting string can be safely used with Uri.parse.

    Parameters

    • Optional skipEncoding: boolean

      Do not percentage-encode the result, defaults to false. Note that the # and ? characters occuring in the path will always be encoded.

    Returns string

    A string representation of this Uri.

with

  • with(change: object): Uri
  • Derive a new Uri from this Uri.

    let file = Uri.parse('before:some/file/path');
    let other = file.with({ scheme: 'after' });
    assert.ok(other.toString() === 'after:some/file/path');

    Parameters

    • change: object

      An object that describes a change to this Uri. To unset components use null or the empty string.

      • Optional authority?: string
      • Optional fragment?: string
      • Optional path?: string
      • Optional query?: string
      • Optional scheme?: string

    Returns Uri

    A new Uri that reflects the given change. Will return this Uri if the change is not changing anything.

Static file

  • file(path: string): Uri
  • Create an URI from a file system path. The scheme will be file.

    Parameters

    • path: string

      A file system or UNC path.

    Returns Uri

    A new Uri instance.

Static parse

  • parse(value: string): Uri
  • Create an URI from a string. Will throw if the given value is not valid.

    Parameters

    • value: string

      The string value of an Uri.

    Returns Uri

    A new Uri instance.