Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@appku/fairu

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appku/fairu

Provides a CLI and layer of functionality to work with generated model types from stashku OPTIONS requests, letting you maintain models of your stashku-accessible data.

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Fairu

Fairu is an asynchronous utility library that provides fast and reliable file-system operations that can be daisy chained together and leverage glob patterns, and serialization to toml, json, and yaml. This is a utility library for the AppKu ecosystem which provides file and directory read/write operations for regular, YAML, TOML, and env files.

Usage

Fairu is designed to be usable through a series of chained methods. These methods define how Fairu will perform the final action, either discovery, reading, writing, appending, touching, or unlinking.

Your Fairu usage should almost always begin with a .with call to specify the paths (which may be glob patterns). You then can follow up with methods to define how Fairu will behave, such as specifying .throw(false) to have Fairu avoid throwing errors and instead continue processing.

Example Discovering Files

let found = await Fairu
    .with('./**/*')
    .discover();

Example Reading Files

let readFiles = await Fairu
    .with('./path/to/files.*')
    .throw(false)
    .read();

Example Writing Files

let writeResults = await Fairu
    .with('./hello.txt')
    .write('hello world!');

Example Appending Files

let appendResults = await Fairu
    .with('./hello.txt', 'only-mars.txt')
    .append('\nalso, hello Mars!');

Example Touching Files

let writeResults = await Fairu
    .with('./hello.txt')
    .touch();

Configuration

By default, Fairu works out of the box without needing any adjustment. You can tweak the behavior of path discovery though by setting the options property on the Fairu instance you create. This affects the path matching and discovery prior to taking action on defined paths.

Example

let f = new Fairu();
f.options = {
    absolute: true,
    debug: true
};
//f.with(...paths) etc.

You can find the full documentation on these options on the glob package's README.

Documentation

You can find examples and the fully published documentation at appku.github.io/fairu.

If you'd like to generate the documentation locally, you can do so by running npm run docs and the site will be statically generated under the docs/ path.

Installing

npm i @appku/fairu

Testing

This project uses jest to perform unit tests.

Running Tests

Run npm test to run jest unit tests.

Run npm run lint to run ESLint, optionally install the Visual Studio Code ESLint extension to have linting issues show in your "Problems" tab and be highlighted.

If you are writing unit tests, you may need to npm install @types/jest to get intellisense in Visual Studio Code if for some reason it did not get installed.

Publishing

Only maintainers with proper access can publish this package to npm. To do so as maintainers, you can publish by running the following command:

npm publish --registry=https://registry.npmjs.org --access=public

Keywords

FAQs

Package last updated on 04 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc