UploadUnit

flitter-upload/UploadUnit~ UploadUnit

Unit that prepares and provides services for uploading, accessing, and sending files.


Constructor

new UploadUnit()

Extends

Members

(static) name

Get the name of the service provided by this unit: 'upload'

(static) services

Defines the services required by this unit.

(private) _di_allow_defer :boolean

If true, the injector will defer the class if the class requests any services that the container is missing. These services are filled in later and added to the prototype and any instances. True by default.

Type:
  • boolean

(private) _di_deferred_instances :Array.<module:flitter-di/src/Injectable~Injectable>

Collection of instances of this class that need to have the deferred service instances injected into them when the deferred services are finally provided.

(private) _di_deferred_services :Array.<string>

List of services that were deferred and not provided at the time of injection.

Type:
  • Array.<string>

default_store_name :boolean|string

Name of the default store. False if not set. Loaded from 'configs::upload.default_store'.

Type:
  • boolean | string

store_classes :object

Object mapping store type names to static class references for the store types supported by flitter-upload.

Should map string -> module:flitter-upload/store/Store~Store class definitions.

Supported types:

  • FlitterStore
Type:
  • object

store_configs :object

Store configurations loaded from 'configs::upload.stores'.

Type:
  • object

stores :object

Mapping of store names to instances of the stores themselves. e.g. maps string -> module:flitter-upload/store/Store~Store.

Type:
  • object

Methods

(async) cleanup(app) → {Promise.<void>}

Cleans up the unit's resources before Flitter closes.

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp

the Flitter app

Returns:
Type
Promise.<void>

(async) deploy() → {Promise.<void>}

Handler for the 'upload' deployment. This creates the 'upload:UploadFile' middleware, and the upload configuration.

Returns:
Type
Promise.<void>

directories() → {Object}

Get the directories provided by the unit. Should be an object such that key => value is the name of the directory => fully qualified path to the directory.

Returns:
Type
Object

get(store_name) → {module:flitter-upload/store/Store~Store}

Get a configured store by name. This is registered as the 'uploader' canonical resolver.

Parameters:
Name Type Description
store_name string

(async) go(app) → {Promise.<void>}

Initialize the unit. Load the configurations from config files, then instantiate the configured stores.

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp

the application

Returns:
Type
Promise.<void>

name() → {String}

Get the name of the unit. Should be a lowercase, alphanum/dash/underscore string.

Returns:
Type
String

provider() → {module:flitter-upload/store/Store~Store}

Get the default file store provider.

status(setopt) → {string}

Get or set the unit's current status.

Parameters:
Name Type Attributes Description
set string <optional>

if provided, set the status of the unit

Returns:
  • current status of the unit
Type
string