-
-
Notifications
You must be signed in to change notification settings - Fork 42
Home
Gustavo Rodrigues edited this page Jan 4, 2017
·
10 revisions
import {createWriteStream} from 'fs'
import {File} from 'mega'
const file = File.fromURL('https://mega.nz/#!MAsFwa4b!d8o1uz6SffMAATSQmERLIYITkyc-eTbKQ6xqI3IQSms')
file.loadAttributes((error, file) => {
console.log(file.name) // big-buck-bunny_trailer.webm
console.log(file.size) // 2.1MB (in bytes)
file.download().pipe(createWriteStream(file.name))
})
- 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