3.1.0 • Published 3 years ago

nnloader v3.1.0

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

nnLoader

What it does?

    The name nnLoader stands for 'no nonsense loader'. This is a small library to load static files from your package root. It aims to be as simple as possible.

Why create a library for this?

    One day I was dealing with a project in which I had a YAML configuration file. That file had to be loaded from multiple files, but to do so I had to know the relative path to the YAML from each one of those files. So I created this lib to be able to load that YAML using a relative path to the package root. This way each file loads that YAML with the same piece of code.

How do I use it?

    With three simple fast steps:

  1. Install the package: yarn add nnloader or npm i nnloader.

  2. Import the package: const nnloader = require('nnloader') or import nnloader from 'nnloader'.

  3. Call one of the functions:

// This function gives you a string with the contents of the file.
const configString = await nnloader.loadString(
    'configs/global.yaml', // The file you want to load
    'utf-8', /* This is optional, it sets the encoding option
            * for the node function fs.promises.readFile()
            */
);

More information and the complete documentation can be found at: https://reclusivebox.github.io/nnloader/

3.1.0

3 years ago

2.1.1

3 years ago

3.0.0

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago