All Projects â†’ YahooArchive â†’ Locator

YahooArchive / Locator

Licence: bsd-3-clause
A node module that gives semantic meaning to filesystem paths.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Locator

Finder
🔍 Finder: find files and directories with an intuitive API.
Stars: ✭ 765 (+3542.86%)
Mutual labels:  filesystem
Appfolder
🗂 Never use NSSearchPathForDirectoriesInDomains again
Stars: ✭ 928 (+4319.05%)
Mutual labels:  filesystem
Simplefs
åŸēäēŽå†…å­˜įš„įŽ€æ˜“æ–‡äģļįŗģįģŸåŽžįŽ°
Stars: ✭ 9 (-57.14%)
Mutual labels:  filesystem
Distribyted
📂 ➡ī¸ đŸ“ē đŸŽļ 🎮 Torrent client with on-demand file downloading as a filesystem.
Stars: ✭ 791 (+3666.67%)
Mutual labels:  filesystem
Node Ntfs
Windows NT File System (NTFS) file system driver
Stars: ✭ 18 (-14.29%)
Mutual labels:  filesystem
Apfs Fuse
FUSE driver for APFS (Apple File System)
Stars: ✭ 929 (+4323.81%)
Mutual labels:  filesystem
Memacs
What did I do on February 14th 2007? Visualize your (digital) life in Org-mode
Stars: ✭ 711 (+3285.71%)
Mutual labels:  filesystem
Pyfiling
Python script that organizes files in a folder or directory according to file type/extension.
Stars: ✭ 12 (-42.86%)
Mutual labels:  filesystem
Tagstore
a research software; a fun way of storing files & folders on your local disk drive; tagging
Stars: ✭ 18 (-14.29%)
Mutual labels:  filesystem
System.io.abstractions
Just like System.Web.Abstractions, but for System.IO. Yay for testable IO access!
Stars: ✭ 844 (+3919.05%)
Mutual labels:  filesystem
Simplefs
A simple, kernel-space, on-disk filesystem from the scratch
Stars: ✭ 831 (+3857.14%)
Mutual labels:  filesystem
Macosx Vfs Isolation Filter
A MacOS VFS isolation layer to redirect file I/O operations.
Stars: ✭ 18 (-14.29%)
Mutual labels:  filesystem
Testfs
A simple fs.FS implementation to be used inside tests.
Stars: ✭ 27 (+28.57%)
Mutual labels:  filesystem
Fdir
⚡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s
Stars: ✭ 777 (+3600%)
Mutual labels:  filesystem
Fusell Seed
FUSE (the low-level interface) file system boilerplate 📂 🔌 💾
Stars: ✭ 9 (-57.14%)
Mutual labels:  filesystem
Fuse Rs
Rust library for filesystems in userspace (FUSE)
Stars: ✭ 735 (+3400%)
Mutual labels:  filesystem
Fuse Copyfs
CopyFS is the copy-on-write (COW) versioned filesystem for FUSE. Years ago I added features to CopyFS 1.0, then 1.0.1 came out and I never bothered to forward-port my changes. Now I have. Master is 1.3.1M, which is CopyFS 1.0.1 + 1.3M
Stars: ✭ 24 (+14.29%)
Mutual labels:  filesystem
Read Multiple Files
Read multiple files Observable way
Stars: ✭ 13 (-38.1%)
Mutual labels:  filesystem
Memfs
In-memory filesystem with Node's API
Stars: ✭ 854 (+3966.67%)
Mutual labels:  filesystem
Path.swift
Delightful, robust, cross-platform and chainable file-pathing functions.
Stars: ✭ 839 (+3895.24%)
Mutual labels:  filesystem

locator

The locator gives semantic meaning to files on the filesystem. It does this with a set of "rules" that describes how each file path should be interpreted. In addition it groups files into "bundles". (Each bundle is usually an NPM module, but not always.)

The locator doesn't interpret the semantic meaning of the files. It is up to the user to understand and use the semantic meanings associated with the files.

Build Status

Goals & Design

  • provide an abstraction over filesystem paths
    • set of "rules" (regexps basically) that determine the semantic meaning of each file
    • files that match a rule (and thus have semantic meaning) are called "resources"
    • built-in handling of "selectors", for resources that have multiple versions
  • organize files in bundles
    • bundles are usually NPM modules
    • ...but can be something else, if an NPM module delivers multiple child bundles
    • bundles are recursively walked, since they are often organized in a tree structure on disk
    • bundles can have different types
      • for example, a mojito application bundle is walked differently (uses a different ruleset) than a mojito mojit bundle
      • each bundle can declare its type in its package.json (for those bundles that are NPM modules)
      • each bundle can also describe the type of child bundles found at certain paths (for e.g. mojito application that has mojit bundles at a certain place)
  • configurable
    • the behavior of the locator should be configurable, which should include
    • ...defining new rulesets, for new bundle types
    • ...general runtime behavior configuration of returned values
    • ...etc

Installation

Install using npm:

$ npm install locator

Example: Mojito Application

In your app's package.json:

{
    "dependencies": {
        ...
        "mojito": "*",
        ...
    },
    "locator": {
        "rulesets": "mojito/locator-rulesets"
    }
}

Example: Defining Your Own Semantics

In your app's package.json:

{
    "locator": {
        "rulesets": "locator-rulesets"
    }
}

A new locator-rulesets.js file which defines how to add semantic meaning to filesystem paths:

module.exports = {
    // nameKey defaults to 1
    // selectorKey has no default. selector is only used if selectorKey is given
    main: {
        // we can use this to skip files
        _skip: [
            /^tests?\b/i
        ],

        // where to find configuration files
        configs: {
            regex: /^configs\/([a-z_\-\/]+)\.(json|js)$/i
        },

        // where to find templates
        templates: {
            regex: /^templates\/([a-z_\-\/]+)(\.([\w_\-]+))?\.[^\.\/]+\.html$/i,
            // We use "selectors" because we might use different templates based
            // on different circumstances.
            selectorKey: 3
        },

        // where to find CSS files
        css: {
            regex: /^public\/css\/([a-z_\-\/]+)\.css$/i
        }
    }
};

Then, in your app.js (or wherever makes sense to you) you can do something like:

var Locator = require('locator');

locator = new Locator();
var resources = locator.parseBundle(__dirname);

// access your "configs/foo.json" configuration file
... resources.configs.foo ...

// access all your templates
Object.keys(resources.templates).forEach(function (templateName) {
    var templateResource = resources.templates[templateName];
    ...
});

Example: Defining Your Own Bundle Name

In your app's package.json:

{
    "name": "usually-a-long-name-for-npm"
    "locator": {
        "name": "foo"
    }
}

By default, locator will select the name of the bundle from the package.json->name entry, but you should be able to specify a custom name by adding a name entry under the locator entry in package.json. This will help to decouple the name of the package from the urls that you will use to fetch those scripts from the client side.

License

This software is free to use under the Yahoo! Inc. BSD license. See the LICENSE file for license text and copyright information.

Contribute

See the CONTRIBUTING.md file for information on contributing back to Locator.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].