nodejs中path模块的用法

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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,915评论 18 139
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,868评论 0 23
  • Pathname lookup in Linux. This write-up is based on three...
    朔飞阅读 690评论 0 0
  • Correctness AdapterViewChildren Summary: AdapterViews can...
    MarcusMa阅读 8,912评论 0 6
  • 翻腾着血的暗流 滑翔过淹没在困惑中的山岗 在逼仄的峡谷里 无数闪电挥舞着光剑狰狞地激荡 穿过巩膜的问号 在沟壑间搭...
    季梦VC_ETG阅读 371评论 4 12