const FileBasedStoreLoader = require('@unitybase/base').FileBasedStoreLoader
let loader = new FileBasedStoreLoader({
  entity: me.entity,
  foldersConfig: folders,
  fileMask: /-fm\.def$/,
  onBeforeRowAdd: postProcessing
})
let resultDataCache = loader.load()
  

# new FileBasedStoreLoader (configObject)

Arguments:
  • config: Object
    • entityUBEntity

    • foldersConfigArray.<{path: string}>

      Array of folder configuration to scan for files. Necessary param is path - path to folder. You can also pass additional information for use in onBeforeRowAdd and onNewFolder callbacks. Currently processed root folder accessible from FileBasedStoreLoader.processingRootFolder

    • zipToArrayBoolean

      Transform result from array of object to array-of-array representation. Default true

    • uniqueIDBoolean

      Result data must contain ID attribute and values must be unique. Default true.

    • fileMaskRegExp

      Regular expression to filter folder files. Each fileName (without path) will be tested by this regExp

    • attributeRegExpStringString

      String representation of regular expression to found attribute and it value in input content. Default is '^\/\/@(\w+)\s"(.*?)"' what mean find all string like: //@attribute "value" You can pass empty string to disable attribute parsing by regExp and do it manually in onBeforeRowAdd handler.

    • onBeforeRowAddfunction

      Callback called for each row BEFORE it added to store. In case it return false row not added. Called with args (this: FileBasedStoreLoader, fullFilePath: string, fileContent: string, oneRow: Object);

    • onNewFolderfunction

      Callback called for each new folder in case of recursive folder. In case callback return false or not defined - folder not processed. Called with args (this: FileBasedStoreLoader, fullFolderPath: string, recursionLevel: integer);

Members

# attributes : Array.<Object> instance

Entity attributes array

# config : Object instance

Configuration

# haveCreateDate : Boolean instance

Is mStore.simpleAudit enabled for current entity (exist mi_createDate attribute)

# haveModifyDate : Boolean instance

Is mStore.simpleAudit enabled for current entity (exist mi_modifyDate attribute)

# processingRootFolder : * instance

Currently processed root folder

# resultCollection : Array.<Object> instance

Array of Object representing dirty result

Methods

# load () → TubCachedData instance

Perform actual loading.