-
-
Notifications
You must be signed in to change notification settings - Fork 45
Home
Gustavo Rodrigues edited this page Jan 2, 2018
·
10 revisions
import { File } from 'megajs'
const file = File.fromURL('some file url')
file.loadAttributes((error, file) => {
console.log(file.name) // file name
console.log(file.size) // file size in bytes
file.download((err, data) => {
if (err) throw err
console.log(data.toString()) // file contents
})
})
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