2023-02-26 01:30

This commit is contained in:
2023-02-26 01:30:37 +09:00
commit 9a13ccbd17
122 changed files with 32148 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
const path = require('path');
const p = '/var/sample.txt';
// containing dir
console.log(path.dirname(p));
// filename
console.log(path.basename(p));
// ext
console.log(path.extname(p));
// file name without ext
console.log(path.basename(p, path.extname(p)));
// build abs path
const userName = 'steve';
console.log(
path.resolve('/', 'users', userName, 'notes.txt')
);
// full path with cwd
console.log(
path.resolve('sample.txt')
);
// normalize
console.log(
path.resolve('/users/steve/..//sample.txt')
);