Function parsePath

  • 解析路径

    parsePath("c:/a/b/c.png") 
    // 返回
    { isMatch: true, root: "c:/", dir: "a/b/", ext: ".png", base: "c.png", name: "c" }
    // --
    parsePath("/a/b/c.png")
    // 返回
    { isMatch: true, root: "/", dir: "a/b/", ext: ".png", base: "c.png", name: "c" }
    // --
    parsePath("/a/b/c.png?foo=bar")
    // 返回
    { isMatch: true, root: "/", dir: "a/b/", ext: ".png?foo=bar", base: "c.png?foo=bar", name: "c" }
    // --
    parsePath("../b/c")
    // 返回
    { isMatch: true, root: "", dir: "../b/", ext: "", base: "c", name: "c" }
    //--
    parsePath("./b/c")
    // 返回
    { isMatch: true, root: "", dir: "./b/", ext: "", base: "c", name: "c" }

    Returns

    Parameters

    • pathname: string

    Returns ParsedPath

Generated using TypeDoc