object-file

Object-Oriented Folder/Directory Class.


Keywords
abstract-file, object, object-oriented, file, folder, directory, data, storage, class, klass
License
MIT
Install
npm install object-file@0.0.0

Documentation

object-file npm

Build Status Code Climate Test Coverage downloads license

Object-Oriented Folder/Directory Class.

  • Each folder are an object.
  • Each folder object could have many attributes.
    • It could be all defined in the index file(README) or .value file of a folder.
    • It could be defined in the attribute files(.[AttributeName]) of a folder separately.
    • The separately attributes priority is greater than the attributes in the index file.
    • The attribute could be an object(folder) too.
  • The folder(directory) tree is the inheritance tree of the object.

Mechanism

  • LRU Cache
    • All file objects are cached into a global LRU Cache.
    • Some parent object could not be in memory always.
  • Lazy Loading

Inheritance

  • The child object inherits all attributes of the parent object by default.
  • The parent object can disable some attributes to be inherited by child(not allowed to be inherited).
    • Inheritable

Object on file system

  • The folder name is an object name.
  • The attribute name starts with the dot('.') char.
  • The extension name means the format of the contents.

Usage

register  = require 'object-file'

API

attributes

The dynamic attributes of an object. Howto merge these attributes into an object directly?

The value of attributes on the class is the type of attributes. It's meaningful only on the class instance.

attribute(aName[, aValue])

get or set a dynamic attribute.

  • getAttribute(aName)
  • setAttribute(aName, aValue)

find(aPattern, aCount, aSkipCount)

find the specified pattern's the children of an object.

getFolder(aPath)

get an object.

createFolder(aPath)

TODO

License

MIT