美文网首页
path.join(__dirname,'./public')

path.join(__dirname,'./public')

作者: 我加入简书的路程 | 来源:发表于2020-02-11 21:58 被阅读0次

    path路径操作模块

    path.basename()
    path.dirname('c:/a/b/c/d/index.js')
    'c:/a/b/c/d'
    
    path.extname()
    path.extname('c:/a/b/c/d/index.js')
    '.js'
    
    path.isAbsolute(path)
    > path.isAbsolute('C:/A/B/C/S')
    true
    > path.isAbsolute('/A/B/C/S')
    true
    > path.isAbsolute('./A/B/C/S')
    false
    > path.isAbsolute('A/B/C/S')
    false
    path.join('c:/a','b')
    'c:\\a\\b'
    
    {
      resolve: [Function: resolve],
      normalize: [Function: normalize],
      isAbsolute: [Function: isAbsolute],
      join: [Function: join],
      relative: [Function: relative],
      toNamespacedPath: [Function: toNamespacedPath],
      dirname: [Function: dirname],
      basename: [Function: basename],
      extname: [Function: extname],
      format: [Function: bound _format],
      parse: [Function: parse],
      sep: '\\',
      delimiter: ';',
      win32: [Circular],
      posix: {
        resolve: [Function: resolve],
        normalize: [Function: normalize],
        isAbsolute: [Function: isAbsolute],
        join: [Function: join],
        relative: [Function: relative],
        toNamespacedPath: [Function: toNamespacedPath],
        dirname: [Function: dirname],
        basename: [Function: basename],
        extname: [Function: extname],
        format: [Function: bound _format],
        parse: [Function: parse],
        sep: '/',
        delimiter: ':',
        win32: [Circular],
        posix: [Circular],
        _makeLong: [Function: toNamespacedPath]
      },
      _makeLong: [Function: toNamespacedPath]
    }
    
    • basename
      • 获取一个路径的文件名(包含默认的扩展名)
    • dirname
    • extname
    • parse
    • join

    相关文章

      网友评论

          本文标题:path.join(__dirname,'./public')

          本文链接:https://www.haomeiwen.com/subject/mtuffhtx.html