ArticleslgStudy

science

File URI scheme

File URI scheme is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand File URI scheme rather than just read about it. In short: file is a Uniform Resource Identifier (URI) scheme used to identify a resource in a file system. Format A file URI has the format file://host/path where host is the fully qualified domain name of the system on which the path is accessible, and path is a hierarchical directory path of the form directory/directory/.../name.

Key takeaways

  • File URI scheme belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect File URI scheme to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of File URI scheme from memory before moving on to harder problems.

Reference excerpt

file is a Uniform Resource Identifier (URI) scheme used to identify a resource in a file system.

Format A file URI has the format

file://host/path

where host is the fully qualified domain name of the system on which the path is accessible, and path is a hierarchical directory path of the form directory/directory/.../name. If host is omitted, it is taken to be "localhost", the machine from which the URL is being interpreted. Note that when omitting host, the slash is not omitted (while "file:///piro.txt" is valid, "file://simpen.txt" is not, although some interpreters manage to handle the latter). RFC 3986 includes additional information about the treatment of ".." and "." segments in URIs.

Number of slash characters The character sequence of two slash characters (//) after the string file: denotes that either a hostname or the literal term localhost follows, although this part may be omitted entirely, or may contain an empty hostname. The single slash between host and path denotes the start of the local-path part of the URI and must be present. A valid file URI must therefore begin with either file:/path (no hostname), file:///path (empty hostname), or file://hostname/path. file://path (i.e. two slashes, without a hostname) is never correct, but is often used. Further slashes in path separate directory names in a hierarchical system of directories and subdirectories. In this usage, the slash is a general, system-independent way of separating the parts, and in a particular host system it might be used as such in any pathname (as in Unix systems). There are two ways that Windows UNC filenames (such as \\server\folder\data.xml) can be represented. These are both described in RFC 8089, Appendix E as "non-standard". The first way (called here the 2-slash format) is to represent the server name using the Authority part of the URI, which then becomes file://server/folder/data.xml. The second way (called here the 4-slash format) is to represent the server name as part of the Path component, so the URI becomes file:////server/folder/data.xml. Both forms are actively used. Microsoft .NET (for example, the method new Uri(path)) generally uses the 2-slash form; Java (for example, the method new URI(path)) generally uses the 4-slash form. Either form allows the most common operations on URIs (resolving relative URIs, and dereferencing to obtain a connection to the remote file) to be used successfully. However, because these URIs are non-standard, some less common operations fail: an example is the normalize operation (defined in RFC 3986 and implemented in the Java java.net.URI.normalize() method) which reduces file:////server/folder/data.xml to the unusable form file:/server/folder/data.xml.

Examples

Unix Here are two Unix examples pointing to the same /etc/fstab file on the host's local file system:

file://localhost/etc/fstab file:///etc/fstab

The KDE environment uses URIs without an authority component:

file:/etc/fstab

Windows Here are some examples which may be accepted by some applications on Windows systems, referring to the same, local file C:\WINDOWS\clock.avi

file://localhost/c:/WINDOWS/clock.avi file:///c:/WINDOWS/clock.avi

Note that the drive letter followed by a colon and slash is part of the acceptable file URI.

Implementations

Windows On Microsoft Windows systems, the normal colon (:) after a device letter has sometimes been replaced by a vertical bar (|) in file URLs. This reflected the original URL syntax, which made the colon a reserved character in a path part. To access a file "the file.txt", the following might be used. For a network location:

file://hostname/path/to/the%20file.txt

Or for a local file, the hostname is omitted, but the slash is not (note the third slash):

file:///c:/path/to/the%20file.txt

If a local file is instead accessed by using the form of the hostname example, but substituting hostname with the string "localhost" or a dot ("."), the URI will be converted to a UNC path, in the form \\localhost\c:\path\to\the file.txt or \\.\c:\path\to\the file.txt. In such a case, if the filepath is absolute (beginning with a drive letter designation), then this will not work in the localhost case, since the colon is not allowed in a share name, though will work for the "dot" case so long as the file is actually and not on a share. For example file://./sharename/path/to/the%20file.txt will not work, because it will result in sharename being interpreted as part of the DOSDEVICES namespace, not as a network share.

Web pages File URLs are rarely used in Web pages on the public Internet, since they are only useful if it is known that a specific file exists on the designated host or the local computer. Additionally, web browsers generally disable File URLs in web pages that were not themselves loaded from a File URL for security reasons. The host specifier can be used to retrieve a file from an external source. However, no specific file-retrieval protocol is specified and the interpretation of the host specifier is not well standardized, so it is only useful in specific circumstances.

References

Worked examples

Example 1 — a first encounter with File URI scheme

Start with the simplest possible case. Write down what File URI scheme claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to File URI scheme before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about File URI scheme ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of File URI scheme

In research
File URI scheme appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses File URI scheme in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
File URI scheme is common in secondary-school and first-year university syllabi. It links to neighbouring topics Identifiers, Internet Standards, URI schemes, so understanding it makes those chapters shorter.
In everyday life
Look for File URI scheme outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “File URI scheme” →

How to study File URI scheme in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what File URI scheme means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain File URI scheme out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is File URI scheme in simple terms?

file is a Uniform Resource Identifier (URI) scheme used to identify a resource in a file system. Format A file URI has the format file://host/path where host is the fully qualified domain name of the system on which the path is accessible, and path is a hierarchical directory path of the form direc…

Why does File URI scheme matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study File URI scheme?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on File URI scheme.

Tags

  • Identifiers
  • Internet Standards
  • URI schemes

Keep exploring