Modules (181)






FileServer (extends BaseServer)

Server for file: URLs

Configuration parameters for this server:

  • baseUrl - Optional base URL (populated by the current project)
  • pathResolver - Function to covert absolute native paths to project relative paths
  • root - Native path to the project root (and base URL)
config {baseUrl: string, root: string, pathResolver: function(string): string}
    function FileServer(config) {, config);

    FileServer.prototype = Object.create(BaseServer.prototype);
    FileServer.prototype.constructor = FileServer;



Determines whether we can serve local file.

localPath string
A local path to file being served.
Returns: boolean
true for yes, otherwise false.
    FileServer.prototype.canServe = function (localPath) {
        // FileServer requires that the base URL is undefined and static HTML files
        return (!this._baseUrl && LiveDevelopmentUtils.isStaticHtmlFileExt(localPath));


Returns a file: URL for a given absolute path

path string
Absolute path to covert to a file: URL
Returns: string
Converts an absolute path within the project root to a file: URL.
    FileServer.prototype.pathToUrl = function (path) {
        return encodeURI(PREFIX + path);

    exports.FileServer = FileServer;


Convert a file: URL to a absolute file path

url string
Returns: ?string
The absolute path for given file: URL or null if the path is not a descendant of the project.
    FileServer.prototype.urlToPath = function (url) {
        if (url.indexOf(PREFIX) === 0) {
            // Convert a file URL to local file path
            return decodeURI(url.slice(PREFIX.length));

        return null;