πŸš€ Introducing react-native-aws3-manager: The Ultimate Solution for AWS S3 Management in React Native πŸš€

Tokhirjon
3 min readJul 14, 2024

--

Are you tired of dealing with outdated and unsupported libraries for managing AWS S3 in your React Native projects? Look no further!
🌟 We are excited to introduce react-native-aws3-manager, a robust and actively maintained library designed to simplify your AWS S3 operations. Inspired by the popular but now unmaintained react-native-aws3, this new package brings enhanced features, improved security, and comprehensive documentation to the table. πŸŽ‰

Why Choose react-native-aws3-manager? πŸ€”

react-native-aws3-manager offers several significant advantages over the react-native-aws3 package:

  • Maintained and Updated: Unlike react-native-aws3, which is no longer maintained, react-native-aws3-manager is actively maintained and regularly updated to ensure compatibility with the latest versions of React Native and AWS SDKs. πŸ”„
  • Enhanced Features: This package includes additional functionalities such as the ability to delete objects and retrieve authenticated objects from AWS S3, making it a one-stop solution for all your S3 needs. πŸ’ͺ
  • TypeScript Support: Fully written in TypeScript, react-native-aws3-manager it offers better type safety and an improved developer experience, ensuring your code is less prone to errors. πŸ‘¨β€πŸ’»πŸ‘©β€πŸ’»
  • Improved Security: The library utilizes crypto-js added security features, giving you peace of mind when handling sensitive data. πŸ”
  • Better Documentation: Comprehensive and detailed documentation, including examples for all supported operations, helps you start quickly and efficiently. πŸ“š

Getting Started with react-native-aws3-manager πŸš€

Installation

To install the library and its dependencies, you can use either npm or yarn:

Using npm:

npm install react-native-aws3-manager crypto-js aws-sdk

Using yarn:

yarn add react-native-aws3-manager crypto-js aws-sdk

Usage

The react-native-aws3-manager library provides an easy-to-use interface for uploading, deleting, and retrieving files from AWS S3 in React Native applications. Here are some examples to get you started:

Uploading a File:

import { RNS3 } from "react-native-aws3-manager";

const file = {
uri: "path-to-your-file",
name: "file-name.jpg",
type: "image/jpeg",
};

const options = {
bucket: "your-bucket",
region: "your-region",
accessKey: "your-access-key",
secretKey: "your-secret-key",
successActionStatus: 201,
};

RNS3.put(file, options)
.then((response) => {
if (response.status !== 201) {
throw new Error("Failed to upload image to S3");
}
console.log("Successfully uploaded file to S3:", response.body);
})
.catch((error) => {
console.error("Error uploading file to S3:", error);
});

Deleting a File:

import { RNS3 } from "react-native-aws3-manager";

const options = {
bucket: "your-bucket",
region: "your-region",
accessKey: "your-access-key",
secretKey: "your-secret-key",
};

RNS3.delete("uploads/file-name.jpg", options)
.then((response) => {
if (response.status !== 204) {
throw new Error("Failed to delete file from S3");
}
console.log("Successfully deleted file from S3");
})
.catch((error) => {
console.error("Error deleting file from S3:", error);
});

Retrieving a File:

import { RNS3 } from "react-native-aws3-manager";

const options = {
bucket: "your-bucket",
region: "your-region",
accessKey: "your-access-key",
secretKey: "your-secret-key",
};

RNS3.get("uploads/file-name.jpg", options)
.then((response) => {
if (response.status !== 200) {
throw new Error("Failed to retrieve file from S3");
}
console.log("Successfully retrieved file from S3:", response.body);
})
.catch((error) => {
console.error("Error retrieving file from S3:", error);
});

API Overview πŸ“–

  • RNS3.put(file, options): Uploads a file to AWS S3.
  • file: Object containing uri, name, and type of the file.
  • options: Object containing bucket, region, accessKey, secretKey, keyPrefix, and successActionStatus.
  • RNS3.delete(key, options): Deletes a file from AWS S3.
  • key: String representing the key of the file to delete.
  • options: Object containing bucket, region, accessKey, and secretKey.
  • RNS3.get(key, options): Retrieves a file from AWS S3.
  • key: String representing the key of the file to retrieve.
  • options: Object containing bucket, region, accessKey, and secretKey.

License and Contributions πŸ“

This project is licensed under the MIT License. Contributions are welcome! Please open an issue or submit a pull request for any bugs, improvements, or new features.

By choosing react-native-aws3-manager, you ensure your project benefits from the latest updates, enhanced security, and comprehensive functionality, making AWS S3 management in React Native a breeze.
🌬️ Try it out today and experience the difference! πŸŽ‰

Sign up to discover human stories that deepen your understanding of the world.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Tokhirjon
Tokhirjon

Written by Tokhirjon

🌐 Front-End Dev & 🍏 Swift Fan | UI/UX & SwiftUI | Tech Insights & Stories πŸ“š

No responses yet

Write a response