1.0.8 ā€¢ Published 2 years ago

filenavigator v1.0.8

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
2 years ago

Version GitHub Issues GitHub Pull Requests License



šŸ“ Table of Contents

šŸ§ About

The aim behind this was to make life easier when you use way too much paths in your project, and when their not from the same folder, for instance it's very usefull with EJS.

šŸ Getting Started

Installing

Just install the packet with npm :

$ npm install filenavigator

šŸ”§ Running the tests

Like for each npm package :

$ npm test

šŸŽˆ Usage

/* Imagine you have a folder like that:
ā”€ā”€ā”® ..
  ā”œā”€ā”€ā•¼ LICENSE
  ā”œā”€ā”€ā•¼ README.md
  ā”œā”€ā”€ā”® docs
  ā”‚  ā””ā”€ā”€ā•¼ ico.svg
  ā”œā”€ā”€ā•¼ package.json
  ā””ā”€ā”€ā”® src <-- You're here
     ā”œā”€ā”€ā•¼ index.js
     ā””ā”€ā”€ā•¼ test.js
*/

const fs = require("fs"),
      fn = require("filenavigator"),
      parentDir = fn.Dir.from(".."), // .from is needed if this came from a real path, here we get the parent folder of the script
      parentDirRoot = parentDir.asRoot(); // Here we make a copy of parentDir but his paths have removed the part from the parent ("..")

// Then you can navigate in the directory:

const ico = fs.readFileSync(parentDir.docs.ico);

for (let child of parentDir) console.log(child);

// You can also visualize the directory:

console.log(parentDir.tree);

šŸš€ Deployment

Build and tested on a linux, no certification this will work on windows but I think it's working on, anyway if it doesn't report here.

šŸš€ Limitations

There is no support for file with the same name but not the same extension. Beside that it's good to know that module can slow you're programm if you scan bif folder without setting a depth limit. The current transformation to turn file name in object key is like that:

index.js --> index // For normal name

.vscode --> _vscode // For hidden unix name

hello.world.txt --> hello_world // For name with multilple dots

ā›ļø Built Using

āœļø Authors

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago