-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpath.mod.js
More file actions
22 lines (19 loc) · 802 Bytes
/
path.mod.js
File metadata and controls
22 lines (19 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const path = require("path");
console.log("This file path:", __filename);
console.log("This directory path:", __dirname);
console.log("-".repeat(67));
const testPath = "/Ahnaf/banners/linkedinBanner.png";
console.log("File Path:", testPath);
console.log("Directory Path:", path.dirname(testPath));
console.log("File Name:", path.basename(testPath));
console.log("File Extension:", path.extname(testPath));
console.log("Normalized Path:", path.normalize(testPath));
console.log(
"Path constructed from Object:",
path.format({ dir: "/Ahnaf/banners", name: "linkedinBanner", ext: "png" }),
);
console.log("Path Details constructed from Path:", path.parse(testPath));
console.log(
"Path from /fs/read-file-sync to /data/love-diary:",
path.relative("fs/read-file-sync.js", "data/love-diary.txt"),
);