Skip to content

Ale46/Mega-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

With the official mega sdk this project is DEPRECATED.

MegaJava

Java library for the mega.co.nz API, currently supporting:

  • login
  • downloading
  • list directory & files (also if shared from others)
  • get download link
  • add contacts
  • get space left

This work is based on the source code released by @NT2005.

Requirements

Java-json

How to use

Import MegaJava and json library on your project

Login (you need this step before do anything)

MegaHandler mh = new MegaHandler("[email protected]", "password");
mh.login();

Get user details

mh.get_user()

Get and print user files

ArrayList<MegaFile> mf = mh.get_files();
  for(int i = 0;i<mf.size();i++)
		System.out.println(mf.get(i).isDirectory() ? "[DIR]"+mf.get(i).getName() : "[File]"+mf.get(i).getName());

Download files from url

try {
  mh.download("https://mega.co.nz/#!xVUkCKbY!Aq_5U3HiWTJMEAK7N_5ENGugZVp0bMj9C8JSjgF8zBM", "C:\\Users\\admin\\Desktop");
  //download displaying progress bar and speed information
  mh.download_verbose("https://mega.co.nz/#!xVUkCKbY!Aq_5U3HiWTJMEAK7N_5ENGugZVp0bMj9C8JSjgF8zBM", "C:\\Users\\admin\\Desktop");
  //download in the active directory
  mh.download("https://mega.co.nz/#!xVUkCKbY!Aq_5U3HiWTJMEAK7N_5ENGugZVp0bMj9C8JSjgF8zBM");
  
} catch (InvalidAlgorithmParameterException e) {
  e.printStackTrace();
}

Get download url (works only against own files)

mh.get_url(MegaFile);

Add a contact

mh.add_user("[email protected]")

Get free space (bytes)

mh.get_quota();

About

Java library for the mega.co.nz API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages