npm

Need private packages and team management tools?Check out npm Orgs. »

file-management-simple

0.0.7 • Public • Published

file-management

Simple File Management. Reads json files.

Install

$ npm i -g npm
▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
$ npm i --save file-management
▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟

Usage

main.js

/// File Management Reference
var FileManagement = require('file-management-simple')
 
/// Test Params For Json
var MockJson      = {
                    File: './tests/sample/test.json',
                    FileName: 'test.json',
                    FileFolder: './tests/sample',
                    FileContent: { 'value' : 'Sample file content.' }
                  }
 
/// Is the file foldeer defined resolved
var folder        = new FileManagement()
                    .setFile(MockJson.File)
                    .File
                    .Folder
 
/// Is the file name defined resolved
var file          = new FileManagement()
                    .setFile(MockJson.File)
                    .File
                    .Name
 
/// Does the file return as string
var content       = (new FileManagement()
                    .setFile(MockJson.File)
                    .File)
                    .ToString()
 
/// Does the file return as json
var jsContent     = (new FileManagement()
                    .setFile(MockJson.File)
                    .File)
                    .ToJson()
                    .value
 
console.log(`------------------------------------------------js`)
console.log(`Sample\t${MockJson.File}`)
console.log(`Folder\t${folder}`)
console.log(`File\t${file}`)
console.log(`Content\t${jsContent}`)
 

Try

 
$ node main
 
Sample  : ./tests/sample/test.json
Folder  : ./tests/sample
File    : test.json
Content : Sample file content.

Test

$ npm run test
 
> node tests
 
Simple Test Tool
==================================================
Instance constractor is ok?
Success
--------------------------------------------------
is there Incrementing semantic versions?
Success
--------------------------------------------------
Is the file Folder defined resolved?
Success
--------------------------------------------------
Is the filename defined resolved?
Success
--------------------------------------------------
Does the file return as json?
Success
--------------------------------------------------
 

Pipeline

Build Status

NPM

install

npm i file-management-simple

Downloadsweekly downloads

1

version

0.0.7

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability