FilesAdapter

Adapters~ FilesAdapter

Methods

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

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

Parameters:
Name Type Description
filename string

the filename to save

data *

the buffer of data from the file

contentType string

the supposed contentType

options object

(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:
Type:
Promise

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

deleteFile(filename) → {Promise}

Responsible for deleting the specified file

Parameters:
Name Type Description
filename string

the filename to delete

Returns:
Type:
Promise

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

getFileData(filename) → {Promise}

Responsible for retrieving the data of the specified file

Parameters:
Name Type Description
filename string

the name of file to retrieve

Returns:
Type:
Promise

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

getFileLocation(config, filename) → {string}

Returns an absolute URL where the file can be accessed

Parameters:
Name Type Description
config Config

server configuration

filename string
Returns:
Type:
string

Absolute URL