Skip to content

applyr/node-file-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-file-loader

Build Status

Installation

npm install node-file-loader --save

Usage

To use the loader, first require it:

var Loader = require('node-file-loader');

Methods

load(filePath)

Load file (UTF-8). Returns a promise object containing the file.

Loader.load(__dirname+'/example.txt')
.then(function (file) {
  // handle plain-text file
}).catch(function (err) {
  // handle error
});

yaml(filePath)

Load YAML file into a Javascript object. Returns a promise object containing the object.

Loader.yaml(__dirname+'/example.yml')
.then(function (obj) {
  // handle the file, as a javascript object
})
.catch(function (err) {
  // handle error
});

json(filePath)

Load JSON file into a Javascript object. Returns a promise object containing the object.

Loader.json(__dirname+'/example.json')
.then(function (obj) {
  // handle the file, as a javascript object
})
.catch(function (err) {
  // handle error
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published