Coder Social home page Coder Social logo

common-file-utilitiy's Introduction

common-file-utilitiy

Introduction

This is a Java service to split large file into multiple part/smaller files. In the future, the code will be enhanced to rejoin the splitted files to recreate the original file.

Use case

When uploading large files (50MB or more) to Amazon S3. It is recommended to use multi-part upload when one will upload smaller chunk of files to S3, instead of one large file in one go. This will help to reduce the memory footprint of the Mule application.

How to use the code?

  1. Import the Mule project to Anypoint Studio

  2. Refer to the common-split-large-file-main-flow to see how one can call the splitFile method in the SplitLargeFile class

    Input to the splitFile method:

     String filePath  <-- the absolute path to the 'large' file to be splitted
    
     int fileSplitSize <-- the size of individual smaller files in MB
    

    Output of the splitFile method:

     If no file is found, return  -1
    

    If file size is less than the fileSplitSize, return 0

    If the file is successfully splitted, return number of smaller files it produced

To test the code:

Create some test files and change the below line in the main method accordingly.

String FilePath = "/Users/chiew.lee/test-files/large-test-file-923MB.json";

Note

When running on CloudHub, leverage the /tmp folder.

In all cases, remember to delete the files accordingly to preserve disk space.

common-file-utilitiy's People

Contributors

chiewklee avatar

Stargazers

vitzhakun avatar

Watchers

James Cloos avatar  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.