Class: Uri
Resource identifier for a resource
Constructors
new Uri(scheme, authority, path, query, fragment)
privatenew Uri(scheme,authority,path,query,fragment):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
Source
packages/extension-api/src/extension-api.d.ts:1251
Properties
authority
readonlyauthority:string
Authority is the www.example.com part of http://www.example.com/some/path?query#fragment.
The part between the first double slashes and the next slash.
Source
packages/extension-api/src/extension-api.d.ts:1263
fragment
readonlyfragment:string
Fragment is the fragment part of http://www.example.com/some/path?query#fragment.
Source
packages/extension-api/src/extension-api.d.ts:1283
fsPath
readonlyfsPath:string
The string representing the corresponding file system path of this Uri.
Source
packages/extension-api/src/extension-api.d.ts:1273
path
readonlypath:string
Path is the /some/path part of http://www.example.com/some/path?query#fragment.
Source
packages/extension-api/src/extension-api.d.ts:1268
query
readonlyquery:string
Query is the query part of http://www.example.com/some/path?query#fragment.
Source
packages/extension-api/src/extension-api.d.ts:1278
scheme
readonlyscheme:string
Scheme is the http part of http://www.example.com/some/path?query#fragment.
The part before the first colon.
Source
packages/extension-api/src/extension-api.d.ts:1257
Methods
toString()
toString():
string
Returns
string
Source
packages/extension-api/src/extension-api.d.ts:1322
with()
with(
change):Uri
Derive a new Uri from this Uri.
const foo = Uri.parse('http://foo');
const httpsFoo = foo.with({ scheme: 'https' });
// httpsFoo is now 'https://foo'
Parameters
• change: Object
An object that describes a change to this Uri. To unset components use undefined or
the empty string.
• change\.authority?: string
The new authority, defaults to this Uri's authority.
• change\.fragment?: string
The new fragment, defaults to this Uri's fragment.
• change\.path?: string
The new path, defaults to this Uri's path.
• change\.query?: string
The new query, defaults to this Uri's query.
• change\.scheme?: string
The new scheme, defaults to this Uri's scheme.
Returns
A new Uri that reflects the given change. Will return this Uri if the change
is not changing anything.
Source
packages/extension-api/src/extension-api.d.ts:1299
file()
staticfile(path):Uri
Create an URI from a file system path. The scheme
will be file.
Parameters
• path: string
Returns
Source
packages/extension-api/src/extension-api.d.ts:1236
joinPath()
staticjoinPath(base, ...pathSegments):Uri
Create a new uri which path is the result of joining the path of the base uri with the provided path segments.
Parameters
• base: Uri
An uri. Must have a path.
• ...pathSegments: string[]
One more more path fragments
Returns
A new uri which path is joined with the given fragments
Source
packages/extension-api/src/extension-api.d.ts:1246
parse()
staticparse(value,strict?):Uri
Create an URI from a string, e.g. http://www.example.com/some/path,
file:///usr/home, or scheme:with/path.
Note that for a while uris without a scheme were accepted. That is not correct
as all uris should have a scheme. To avoid breakage of existing code the optional
strict-argument has been added. We strongly advise to use it, e.g. Uri.parse('my:uri', true)
Parameters
• value: string
The string value of an Uri.
• strict?: boolean
Throw an error when value is empty or when no scheme can be parsed.
Returns
A new Uri instance.