Protected
constructorInternal
Optional
authority: stringOptional
path: stringOptional
query: stringOptional
fragment: stringOptional
_strict: booleanInternal
Readonly
authorityauthority 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.
Readonly
fragmentfragment is the 'fragment' part of 'http://www.example.com/some/path?query#fragment'.
Readonly
pathpath is the '/some/path' part of 'http://www.example.com/some/path?query#fragment'.
Readonly
queryquery is the 'query' part of 'http://www.example.com/some/path?query#fragment'.
Readonly
schemescheme is the 'http' part of 'http://www.example.com/some/path?query#fragment'. The part before the first colon.
Returns a string representing the corresponding file system path of this URI. Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the platform specific path separator.
The difference to URI#path
is the use of the platform specific separator and the handling
of UNC paths. See the below sample of a file-uri with an authority (UNC path).
const u = URI.parse('file://server/c$/folder/file.txt')
u.authority === 'server'
u.path === '/shares/c$/file.txt'
u.fsPath === '\\server\c$\folder\file.txt'
Using URI#path
to read a file (using fs-apis) would not be enough because parts of the path,
namely the server name, would be missing. Therefore URI#fsPath
exists - it's sugar to ease working
with URIs that represent files on disk (file
scheme).
Creates a string representation for this URI. It's guaranteed that calling
URI.parse
with the result of this function creates an URI which is equal
to this URI.
Optional
skipEncoding: booleanDo not encode the result, default is false
Optional
authority?: null | stringOptional
fragment?: null | stringOptional
path?: null | stringOptional
query?: null | stringOptional
scheme?: stringStatic
fileCreates a new URI from a file system path, e.g. c:\my\files
,
/usr/home
, or \\server\share\some\path
.
The difference between URI#parse
and URI#file
is that the latter treats the argument
as path, not as stringified-uri. E.g. URI.file(path)
is not the same as
URI.parse('file://' + path)
because the path might contain characters that are
interpreted (# and ?). See the following sample:
const good = URI.file('/coding/c#/project1');
good.scheme === 'file';
good.path === '/coding/c#/project1';
good.fragment === '';
const bad = URI.parse('file://' + '/coding/c#/project1');
bad.scheme === 'file';
bad.path === '/coding/c'; // path is now broken
bad.fragment === '/project1';
A file system path (see URI#fsPath
)
Static
fromStatic
isStatic
parseStatic
revive
Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986. This class is a simple parser which creates the basic component parts (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation and encoding.