当前位置:网站首页>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 
边栏推荐
- The combination of deep learning model and wet experiment is expected to be used for metabolic flux analysis
- Redis implements a high-performance full-text search engine -- redisearch
- Huber Loss
- Halcon shape_ trans
- Blue Bridge Cup provincial match simulation question 9 (MST)
- ABC#237 C
- Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
- [code practice] [stereo matching series] Classic ad census: (5) scan line optimization
- Causes and appropriate analysis of possible errors in seq2seq code of "hands on learning in depth"
- Illustrated network: what is gateway load balancing protocol GLBP?
猜你喜欢

Mathematical modeling: factor analysis

Halcon affine transformations to regions

Business modeling of software model | overview

Programming implementation of ROS learning 6 -service node
![Rebuild my 3D world [open source] [serialization-1]](/img/74/b6253845b43bc18f425d57695fba7c.jpg)
Rebuild my 3D world [open source] [serialization-1]
![3D reconstruction open source code summary [keep updated]](/img/ec/984aede7ef9e758abd52fb5ff4e144.jpg)
3D reconstruction open source code summary [keep updated]
![[matlab] matlab reads and writes Excel](/img/80/78e4c7fcd27473526e480d4b930e2c.jpg)
[matlab] matlab reads and writes Excel
![Rebuild my 3D world [open source] [serialization-2]](/img/e6/aad5f432aca619b992753187729dcf.jpg)
Rebuild my 3D world [open source] [serialization-2]

TF coordinate transformation of common components of ros-9 ROS

Solution to the problems of the 17th Zhejiang University City College Program Design Competition (synchronized competition)
随机推荐
迁移学习和域自适应
Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding
.NET服务治理之限流中间件-FireflySoft.RateLimit
Multiple linear regression (sklearn method)
Solutions of ordinary differential equations (2) examples
The location search property gets the login user name
交通运输部、教育部:广泛开展水上交通安全宣传和防溺水安全提醒
Confusing basic concepts member variables local variables global variables
RT-Thread内核快速入门,内核实现与应用开发学习随笔记
LLVM之父Chris Lattner:为什么我们要重建AI基础设施软件
The combination of deep learning model and wet experiment is expected to be used for metabolic flux analysis
Business modeling of software model | overview
一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]
AdaBoost use
Programming implementation of ROS learning 6 -service node
容易混淆的基本概念 成员变量 局部变量 全局变量
我从技术到产品经理的几点体会
[牛客网刷题 Day4] JZ55 二叉树的深度
Pearson correlation coefficient
Add discount recharge and discount shadow ticket plug-ins to the resource realization applet