GithubHelp home page GithubHelp logo

buabook / amazon-s3-file-transfer Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 34 KB

Provides file upload and download wrapper classes for AWS S3 SDK

License: Apache License 2.0

Java 100.00%
amazon-s3-storage

amazon-s3-file-transfer's Introduction

Amazon S3 File Transfer Library

This library provides file upload and download wrapper classes for the AWS S3 SDK.

Maven Central Build Status Coverage Status

Uploading

We wrap a TransferManager with the following features:

  • Application environment path prefix
    • This allows multiple environments to use the same S3 bucket but data separation at the root level of the bucket between them. The environment can be specified as any String.
  • Automatic content length calculation
  • Files downloaded straight to String

Uploading can be performed in 3 ways, each allow the caller to do more configuration:

  • Using an UploadContent object - requires supplying the file content as a String along with a file name for the upload.
  • Using a file name and InputStream
  • Using your own PutObjectRequest

Modifying Uploaded File Permissions

By default the permissions of a newly uploaded file will be inherited from the parent folder or bucket. If you want to upload a file with different permissions, you can use the uploadSync method directly, supplying your own PutObjectRequest:

PutObjectRequest uploadRequest = s3FileUploader.getNewPutObjectRequest(s3Path, fileDataInputStream, fileDataLength);
// Allow everyone to read uploaded file
uploadRequest.setCannedAcl(CannedAccessControlList.PublicRead);

try {
    s3FileUploader.uploadSync(uploadRequest);
} catch (AmazonClientException | IllegalArgumentException e) {
    log.error("Failed to upload public file to Amazon. Error - " + e.getMessage(), e);
}

Required Access Permissions

In order to either upload or download files from Amazon S3, an account must be created with the following permissions:

  • Download: GetObject
  • Upload: PutObject

amazon-s3-file-transfer's People

Contributors

jasraj avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.