当前位置:网站首页>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 
边栏推荐
- 皮尔森相关系数
- [beauty of algebra] singular value decomposition (SVD) and its application to linear least squares solution ax=b
- 一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]
- Redis implements a high-performance full-text search engine -- redisearch
- Ecmascript6 introduction and environment construction
- Halcon blob analysis (ball.hdev)
- Understanding rotation matrix R from the perspective of base transformation
- kubeadm系列-00-overview
- [formation quotidienne - Tencent Selection 50] 557. Inverser le mot III dans la chaîne
- C#绘制带控制点的Bezier曲线,用于点阵图像及矢量图形
猜你喜欢

Programming implementation of subscriber node of ROS learning 3 subscriber
![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 2 publisher node

Summary and Reflection on issues related to seq2seq, attention and transformer in hands-on deep learning

Yolov4 target detection backbone

Attention is all you need

Add discount recharge and discount shadow ticket plug-ins to the resource realization applet
![[code practice] [stereo matching series] Classic ad census: (6) multi step parallax optimization](/img/54/cb1373fbe7b21c5383580e8b638a2c.jpg)
[code practice] [stereo matching series] Classic ad census: (6) multi step parallax optimization

How to manage the performance of R & D team?

Install the CPU version of tensorflow+cuda+cudnn (ultra detailed)
随机推荐
2011-11-21 training record personal training (III)
Confusing basic concepts member variables local variables global variables
Multiple linear regression (gradient descent method)
微信H5公众号获取openid爬坑记
[matlab] matlab reads and writes Excel
Redis implements a high-performance full-text search engine -- redisearch
Rebuild my 3D world [open source] [serialization-2]
Basic number theory -- Euler function
C# LINQ源码分析之Count
Characteristic Engineering
Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding
【日常訓練--騰訊精選50】557. 反轉字符串中的單詞 III
ECMAScript6介绍及环境搭建
Solution to the problem of the 10th Programming Competition (synchronized competition) of Harbin University of technology "Colin Minglun Cup"
JS asynchronous error handling
2020 "Lenovo Cup" National College programming online Invitational Competition and the third Shanghai University of technology programming competition
Programming implementation of ROS learning 5-client node
asp. Net (c)
Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding
Luo Gu p3177 tree coloring [deeply understand the cycle sequence of knapsack on tree]