{% hint style="warning" %} The following document assumes that you understand the basics of connecting to databases on Appsmith. If not, please go over them before reading further. {% endhint %}
The S3 plugin can connect to an Amazon S3, Upcloud, Digital Ocean Spaces, Wasabi, DreamObjects and any other provider that supports S3 to execute a set of actions supported by Appsmith.
The S3 Datasource requires the following information to establish a connection
- Amazon Access Key ID
- Amazon Secret Key
- Region: AWS service region.
The Access Key & Secret can be fetched using the following guide: Generate AWS access key & secret
This action lists all the files in a bucket. The bucket name is the bucket from which all the files are fetched. This action returns an array of file paths relative to the bucket. ex. /dir/fileName.txt
.
You can also choose to generate a signed URL for each listed file by selecting Yes
in the Generate Signed URL
dropdown. An expiry duration can be set for the generated signed URLs by editing the Expiry Duration of Signed URL
field. In this case, the output returns two other fields:
signedUrl
: It contains the signed url for the file.urlExpiryDate
: It contains the timestmap at which the signed url will expire.
This action creates a new file at the location specified by the file path (including file name). The action returns the following two fields:
signedUrl
: It contains the signed url for the file.urlExpiryDate
: It contains the timestmap at which the signed url will expire.
An expiry duration can be set for the generated signed URLs by editing the Expiry Duration of Signed URL
field.
{% hint style="warning" %} If a file already exists on the file path, it will be replaced with the new file. {% endhint %}
This action fetches a file in the Bucket Name specified with a file path relative to the bucket. By default, the raw content of the file is returned in the fileData
field of response. File content can also be Base64 encoded by selecting Yes
in the Base64 Encode File - Yes/No
dropdown field.
{% hint style="warning" %} When reading multimedia file or formatted text, please encode the file data using the Base64 Encode dropdown field. Once the data has been received, it can be decoded using the atob() method in javascript. {% endhint %}
This action deletes a file at the file path relative to the Bucket Name specified. Files deleted cannot be restored so ensure your files have been backed up.
{% hint style="success" %} Enable the confirmation setting in this query to avoid accidental file deletes {% endhint %}
Once you have successfully run a Query, you can use it in your application to