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.
foo://example.com:8042/over/there?name=ferret#nose \_/ \______________/\_________/ \_________/ \__/ | | | | | scheme authority path query fragment | _____________________|__ / \ / \ urn:example:animal:ferret:nose
fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'.
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'
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 (
path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'.
query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'.
scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'. The part before the first colon.
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.
Do not encode the result, default is
Creates a new Uri from a file system path, e.g.
The difference between
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
Creates a new Uri from a string, e.g.
A string which represents an Uri (see