美文网首页
nodejs中path模块的用法

nodejs中path模块的用法

作者: 一半苍白 | 来源:发表于2017-04-01 11:56 被阅读0次

    path.join([...paths])

    Added in: v0.1.16

    ...paths <String> A sequence of path segments

    Returns:<String>

    The path.join() method joins all given path segments together using the platform specific separator as a delimiter, then normalizes the resulting path.

    Zero-length path segments are ignored. If the joined path string is a zero-length string then'.'will be returned, representing the current working directory.

    For example:

    path.join('/foo','bar','baz/asdf','quux','..')

    // Returns: '/foo/bar/baz/asdf'

    path.join('foo',{},'bar')

    // throws TypeError: Arguments to path.join must be strings

    TypeError is thrown if any of the path segments is not a string.

    图1-1

    相关文章

      网友评论

          本文标题:nodejs中path模块的用法

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