file-structure-validator
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

file-structure-validator

This library validates that a base directory exists, and an array of files.directory relative to the base directory also exist.

Install

npm install --save file-structure-validator

OR

yarn add file-structure-validator

usage

//ES6 or Typescript
import Fsv from "file-structure-validator";

//OR

//ES5
//var Fsv = require("file-structure-validator").default;

//Create validation structure:

const folderStructure = {
  base: "./", // can be a full path or relative
  files:[
    //files relative to base path
    //example: "test.txt", "subdir/test.txt"
  ],
  dirs: [
    //sub durectories that must exist
    //example: "subdir", "subdir/subdir2"
  ]
};

//create and instance and pass folder structure
const fsv = new Fsv(folderStructure);

//validate
const result = fsv.validate();
if(result.valid){
    //yey everything is where is supposed to be
} else {
    //oh no something is missing
    console.log(result.msg);
}

Readme

Keywords

none

Package Sidebar

Install

npm i file-structure-validator

Weekly Downloads

10

Version

1.0.2

License

MIT

Unpacked Size

107 kB

Total Files

23

Last publish

Collaborators

  • rolfisub