vue中的uri_【file-uri-to-path】转换文件URI 为文件Path

本文介绍了如何在Vue项目中利用`file-uri-to-path`库将file类型的URI转换为适用于fs模块的文件路径。详细展示了安装、使用方法以及API接口的示例。
摘要由CSDN通过智能技术生成

file-uri-to-path

Convert a file: URI to a file path

Accepts a file: URI and returns a regular file path suitable for use with the

fs module functions.

Installation

Install with npm:

$ npm install file-uri-to-path

Example

var uri2path = require('file-uri-to-path');

uri2path('file://localhost/c|/WINDOWS/clock.avi');

// "c:\\WINDOWS\\clock.avi"

uri2path('file:///c|/WINDOWS/clock.avi');

// "c:\\WINDOWS\\clock.avi"

uri2path('file://localhost/c:/WINDOWS/clock.avi');

// "c:\\WINDOWS\\clock.avi"

uri2path('file://hostname/path/to/the%20file.txt');

// "\\\\hostname\\path\\to\\the file.txt"

uri2path('file:///c:/path/to/the%20file.txt');

// "c:\\path\\to\\the file.txt"

API

fileUriToPath(String uri) → String

License

(The MIT License)

Copyright © 2014 Nathan Rajlich

Permission is hereby granted, free of charge, to any person obtaining

a copy of this software and associated documentation files (the

’Software’), to deal in the Software without restriction, including

without limitation the rights to use, copy, modify, merge, publish,

distribute, sublicense, and/or sell copies of the Software, and to

permit persons to whom the Software is furnished to do so, subject to

the following conditions:

The above copyright notice and this permission notice shall be

included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,

EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF

MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY

CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,

TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE

SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Vue微信扫码登录时出现redirect_uri参数错误,这个错误通常是由于Oauth授权域名没有填写导致的。你可以参考的解决方法来修复这个问题。具体来说,你需要在微信开发者平台的授权域名填写你所使用的域名。这样,当用户点击登录按钮并同意授权后,就可以正确获取用户的OpenId等信息了。另外,你还可以参考关于微信公众号二次开发和配置过程的详细说明。记得在解决后端服务问题后,确保看到正确的授权框。希望对你有所帮助。 参考文献: redirect_uri参数错误的解决办法:https://blog.csdn.net/zl544434558/article/details/46785565 解决微信OAuth2.0网页授权只能设置一个回调域名的问题:https://github.com/HADB/GetWeixinCode 微信公众号网页授权:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html 微信公众平台接口调试工具:https://mp.weixin.qq.com/debug<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [redirect_uri参数错误的解决方法(必看)](https://download.csdn.net/download/weixin_38748580/13720294)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [微信公众号授权登录后报redirect_uri参数错误的问题](https://blog.csdn.net/sD7O95O/article/details/126092778)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值