1.1.12 • Published 4 years ago

@wessberg/fileloader v1.1.12

Weekly downloads
76
License
MIT
Repository
github
Last release
4 years ago

A Promise-based class that can offers different ways of loading files from disk, including wrappers around the synchronous I/O methods from node.

Description

DISCLAIMER

This library will be deprecated. There are better alternatives built directly into the fs module now. Use that instead.

Table of Contents

Install

npm

$ npm install @wessberg/fileloader

Yarn

$ yarn add @wessberg/fileloader

pnpm

$ pnpm add @wessberg/fileloader

Usage

const fileLoader = new FileLoader();

// Just a simple Promise-based async I/O method.
const buffer = await fileLoader.load("some_file.ts");

// A wrapper around the "readSync" method from node's "fs" module.
const sync = fileLoader.loadSync("some_file.ts");

// Loads the first matched file associated with the given path
// combined with the given array of ordered extensions.
const [result, path] = await fileLoader.loadWithFirstMatchedExtension("some_path", [".ts", ".fs"]);

// Loads all files in the given directory.
const buffers = await fileLoader.loadAllInDirectory("some_dir");

// Gets a list of all files in the given directory with an extension of "ts".
const buffers = await fileLoader.getFilesInDirectory("some_dir", [".ts"]);

Contributing

Do you want to contribute? Awesome! Please follow these recommendations.

Maintainers

Frederik WessbergTwitter: @FredWessbergGithub: @wessbergLead Developer

Backers

BubblesTwitter: @use_bubbles

Patreon

License

MIT © Frederik Wessberg (@FredWessberg) (Website)

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago