url.fileURLToPathBuffer(url[, options])


  • url <URL> | <string> 要转换为路径的文件 URL 字符串或 URL 对象。
  • options <Object>
    • windows <boolean> | <undefined> 如果 path 应该作为 Windows 文件路径返回则为 true,作为 POSIX 路径返回则为 false,系统默认则为 undefined默认值: undefined
  • 返回:<Buffer> 作为 <Buffer> 的完全解析的平台特定 Node.js 文件路径。

类似 url.fileURLToPath(...),只是它返回的是 Buffer 而不是路径的字符串表示。 当输入的 URL 包含不是有效 UTF-8 / Unicode 序列的百分号编码部分时,这种转换非常有用。

【Like url.fileURLToPath(...) except that instead of returning a string representation of the path, a Buffer is returned. This conversion is helpful when the input URL contains percent-encoded segments that are not valid UTF-8 / Unicode sequences.】