Adapters. FilesAdapter

Methods

createFile(filename, data, contentType, options) → {Promise}

Responsible for storing the file in order to be retrieved later by its filename

Parameters:
NameTypeDescription
filenamestring

the filename to save

data*

the buffer of data from the file

contentTypestring

the supposed contentType

optionsobject

(Optional) options to be passed to file adapter (S3 File Adapter Only)

  • tags: object containing key value pairs that will be stored with file
  • metadata: object containing key value pairs that will be sotred with file (https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-object-metadata.html)
Returns:

a promise that should fail if the storage didn't succeed

Type: 
Promise

deleteFile(filename) → {Promise}

Responsible for deleting the specified file

Parameters:
NameTypeDescription
filenamestring

the filename to delete

Returns:

a promise that should fail if the deletion didn't succeed

Type: 
Promise

getFileData(filename) → {Promise}

Responsible for retrieving the data of the specified file

Parameters:
NameTypeDescription
filenamestring

the name of file to retrieve

Returns:

a promise that should pass with the file data or fail on error

Type: 
Promise

getFileLocation(config, filename) → {string|Promise.<string>}

Returns an absolute URL where the file can be accessed

Parameters:
NameTypeDescription
configConfig

server configuration

filenamestring
Returns:

Absolute URL

Type: 
string | Promise.<string>