StorX Documentation

  • Theme Icon

Storx Integration with Node.js

Here we provide examples for integrating Storx with your Node.js application programmatically using the AWS SDK for JavaScript.

Prerequisites

Before running the code, ensure you have the following prerequisites:

  • Node.js installed on your machine.
  • Access credentials obtained from the Storx dashboard.

Security Considerations

Handle access credentials securely. Avoid hardcoding credentials directly into the code. Instead, consider using environment variables or other secure methods for credential management.

Dependencies

Make sure to install the necessary dependencies using npm:

icon icon

Example Code

Below are functions and examples demonstrating basic operations like creating a bucket, uploading files, listing files, copying files between buckets, downloading files, and cleaning up buckets.

Function to Create a Bucket

icon icon

Function to Upload Files to a Bucket

icon icon

Function to List Files in a Bucket

icon icon

Function to Copy a File from One Bucket to Another

icon icon

Function to Download Files from a Bucket

icon icon

Function to Empty a Bucket

icon icon

Function to Delete a Bucket

icon icon

Function to Upload a File with Timestamped Path

icon icon

Function to Download Files Based on Time Range

icon icon

Explanation:

  • uploadFile: Uploads a file to S3 with a path structured based on the current timestamp.
  • downloadFiles: Retrieves files from S3 within a specified time range, using a common prefix to list and download relevant files.