-
-
Notifications
You must be signed in to change notification settings - Fork 46
Home
Gustavo Rodrigues edited this page Jan 6, 2017
·
10 revisions
import { File } from 'megajs'
const file = File.fromURL('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
- 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