当前位置:网站首页>fs. Path module
fs. Path module
2022-07-05 08:57:00 【Yang Xun】
When using relative paths to read or write files ,node In execution js The file will automatically be node Splicing the current running path of the command with the relative path of reading or writing will lead to reading or writing failure. At this time, it is necessary __dirname To splice paths ,__dirname Represents the absolute path of the current file ,
When using path splicing, if the path contains ./ Then that point will also be node Identifying as a path execution will lead to read or write failure , So we need to use path.join(__dirname,’./ route ’) To splice paths , This method will automatically ignore ./ or …/ In the point , If it is …/ Will automatically offset the previous layer of path, such as path.join(__dirname,’/a’,’/b/c’,’…/d’,’/e’), This path will eventually be spliced into ’\a\b\d\e’
path.basename(‘ Spliced path ’,‘ Suffix to delete ’)
As shown in the figure below :
Get the suffix of the file 
边栏推荐
- Halcon Chinese character recognition
- 3D reconstruction open source code summary [keep updated]
- Configuration and startup of kubedm series-02-kubelet
- Understanding rotation matrix R from the perspective of base transformation
- 交通运输部、教育部:广泛开展水上交通安全宣传和防溺水安全提醒
- [code practice] [stereo matching series] Classic ad census: (5) scan line optimization
- c#比较两张图像的差异
- [牛客网刷题 Day4] JZ35 复杂链表的复制
- [formation quotidienne - Tencent Selection 50] 557. Inverser le mot III dans la chaîne
- Codeworks round 681 (Div. 2) supplement
猜你喜欢

Attention is all you need
![Rebuild my 3D world [open source] [serialization-3] [comparison between colmap and openmvg]](/img/7d/e7370e757c18b3dbb47e633703c346.jpg)
Rebuild my 3D world [open source] [serialization-3] [comparison between colmap and openmvg]

Programming implementation of ROS learning 5-client node

Halcon shape_ trans
![[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation](/img/d8/7291a5b14160600ba73810e6dd1eb5.jpg)
[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation

Shift operation of complement

Halcon Chinese character recognition
![Rebuild my 3D world [open source] [serialization-1]](/img/74/b6253845b43bc18f425d57695fba7c.jpg)
Rebuild my 3D world [open source] [serialization-1]

Typescript hands-on tutorial, easy to understand

Halcon: check of blob analysis_ Blister capsule detection
随机推荐
Warning: retrying occurs during PIP installation
scipy.misc.imread()
[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation
皮尔森相关系数
C#【必备技能篇】ConfigurationManager 类的使用(文件App.config的使用)
Latex improve
【日常训练--腾讯精选50】557. 反转字符串中的单词 III
Programming implementation of ROS learning 6 -service node
Codeworks round 638 (Div. 2) cute new problem solution
C#绘制带控制点的Bezier曲线,用于点阵图像及矢量图形
[code practice] [stereo matching series] Classic ad census: (6) multi step parallax optimization
Jenkins Pipeline 方法(函数)定义及调用
资源变现小程序添加折扣充值和折扣影票插件
Introduction Guide to stereo vision (1): coordinate system and camera parameters
C [essential skills] use of configurationmanager class (use of file app.config)
Mathematical modeling: factor analysis
Program error record 1:valueerror: invalid literal for int() with base 10: '2.3‘
The location search property gets the login user name
AUTOSAR从入门到精通100讲(103)-dbc文件的格式以及创建详解
Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding