Skip to content
Gustavo Rodrigues edited this page Jan 4, 2017 · 10 revisions

Quick start:

import mega from 'mega'

const file = mega.file('https://mega.nz/#!N90lwbqL!MkbqwNRYPF4uFCN35zetE3PHOzP-NQc20hasZxPg5k8')

file.loadAttributes((error, file) => {
  console.log(file.name) // 'test.txt'
  console.log(file.size) // 85 (bytes)

  file.download((err, data) => {
    if (err) throw err
    console.log(data.toString()) // "MEGA", in ASCII art
  })
})

Try the example above on CodePen

API documentation:

  • MEGA: the module entry point
  • Storage: creates a logged in connection instance to MEGA
  • File: allows access to shared files and folders
  • MutableFile: extends File allowing to change file metadata

Implementation notes:

Clone this wiki locally