nv-path-self
v1.0.5
Published
nv-path-self ======================= - parse __filename
Downloads
41
Readme
nv-path-self
- parse __filename
install
- npm install nv-path-self
usage
include this line in your file:
const self_path_v = require("nv-path-self")(__filename)
example
tree TEST/
TEST/
├── C0
│ ├── sib0
│ ├── sib1
│ ├── sib2
│ ├── sib3
│ └── tst.js
└── C1
cat TEST/C0/tst.js
const self_path_v = require("nv-path-self")(__filename);
console.log("parent :", self_path_v.pr);
console.log("siblings :", self_path_v.siblings);
console.log("siblings and self:", self_path_v.siblings_incld_self);
console.log("children :", self_path_v.children);
console.log(self_path_v.pr.dump_to_json())
/*
parent : Desc {
path: '/mnt/sda3/NV6-/nvpath/pkgs/nv-path-self/TEST/C0',
name: 'C0',
ext: '',
type: 'dire'
}
siblings : [
Desc {
path: '/mnt/sda3/NV6-/nvpath/pkgs/nv-path-self/TEST/C0/sib0',
name: 'sib0',
ext: '',
type: 'file'
},
Desc {
path: '/mnt/sda3/NV6-/nvpath/pkgs/nv-path-self/TEST/C0/sib1',
name: 'sib1',
ext: '',
type: 'file'
},
Desc {
path: '/mnt/sda3/NV6-/nvpath/pkgs/nv-path-self/TEST/C0/sib2',
name: 'sib2',
ext: '',
type: 'file'
},
Desc {
path: '/mnt/sda3/NV6-/nvpath/pkgs/nv-path-self/TEST/C0/sib3',
name: 'sib3',
ext: '',
type: 'file'
}
]
siblings and self: [
Desc {
path: '/mnt/sda3/NV6-/nvpath/pkgs/nv-path-self/TEST/C0/sib0',
name: 'sib0',
ext: '',
type: 'file'
},
Desc {
path: '/mnt/sda3/NV6-/nvpath/pkgs/nv-path-self/TEST/C0/sib1',
name: 'sib1',
ext: '',
type: 'file'
},
Desc {
path: '/mnt/sda3/NV6-/nvpath/pkgs/nv-path-self/TEST/C0/sib2',
name: 'sib2',
ext: '',
type: 'file'
},
Desc {
path: '/mnt/sda3/NV6-/nvpath/pkgs/nv-path-self/TEST/C0/sib3',
name: 'sib3',
ext: '',
type: 'file'
},
Desc {
path: '/mnt/sda3/NV6-/nvpath/pkgs/nv-path-self/TEST/C0/tst.js',
name: 'tst',
ext: 'js',
type: 'file'
}
]
children : []
{
'/t': 'dire',
sib0: { '/t': 'file' },
sib1: { '/t': 'file' },
sib2: { '/t': 'file' },
sib3: { '/t': 'file' },
tst: { '/t': 'file' }
}
*/
METHODS
APIS
LICENSE
- ISC
