files

Classes

FileSaveError

Methods

(static) save(config, uxioObject) → {Promise.<Array.<object>>}

Description:
  • Saves one or more files based on the provided configuration. The configuration can be a single object or an array of objects for granular control. On failure, any files that were already saved successfully are deleted (rolled back).
Source:
Parameters:
Name Type Description
config object | Array.<object> The save configuration.
Properties
Name Type Attributes Default Description
fieldname string | Array.<string> The field name(s) of the file(s) to save.
filename string | Array.<string> (DEPRECATED) use fieldname instead.
path string The destination directory to save the files.
required boolean <optional>
false If true, an error is thrown if no files match the filename(s).
makedir boolean <optional>
false If true, the destination directory will be created recursively if not found.
validations validations <optional>
Optional validation rules. see validations
rename function <optional>
A function to rename the file.
uxioObject object The `req.uxio` object containing cached file data.
Returns:
An array of file info objects.
Type
Promise.<Array.<object>>

(static) send(config, uxioObject) → {Promise.<Array.<object>>}

Description:
  • Sends one or more files to an external service (e.g., S3, custom server). On failure, any files that were already sent are deleted from the external service (rolled back).
Source:
Parameters:
Name Type Description
config object | Array.<object> The send configuration.
Properties
Name Type Attributes Default Description
fieldname string | Array.<string> The field name(s) of the file(s) to send.
filename string | Array.<string> <optional>
(DEPRECATED) Use 'fieldname' instead.
provider string The destination service provider (e.g., 's3', 'customHttp').
options object Provider-specific options.
required boolean <optional>
false If true, throws an error if no files match the filename(s).
validations validations <optional>
Optional validation rules. see validations
rename function <optional>
A function to rename the file before sending.
uxioObject object The `req.uxio` object containing cached file data.
Returns:
An array of file info objects from the provider.
Type
Promise.<Array.<object>>

Type Definitions

validations

Source:
Properties:
Name Type Attributes Description
maxSize number <optional>
Maximum file size in bytes.
mimeType Array.<string> <optional>
Allowed MIME types.
Type:
  • object