Git Product home page Git Product logo

mega's Introduction

Build Status

Read first

  • This is all unofficial, based on developer guide and site source.
  • Official SDK will probably be released in the future. You may want to wait.
  • Only part of the API is implemented.
  • Crypto is mostly ported from browser code and isn't optimal. Probably some of it could be done with openssl, ursa or cryptojs or the algorithms could at least be ported to use Buffer format, but this is no way a priority.
  • If you use it for something make sure you agree with Mega's Terms of Service.

Installation

npm install mega
var mega = require('mega')

See examples directory for quick start.

Missing functionality

  • No sharing features
  • Missing file management: move, symlink etc.

Browser support

This module also works in the browser with browserify. Not all patches have landed yet so you should use this fork and [email protected]. See demo page for preview.

API

var storage = mega([options], [readyCallback])

Create new connection instance to Mega.

Supported options:

email - User login email.

password - User password.

keepalive - Keep connection open to receive server-to-client requests that will be mapped to events. Defaults to true.

autoload - Load in file structure. Defaults to true.

If you don't specify email/password then temporary account will be created. Once connection closes for temporary account you cannot access same account again so you need to save a link to file. Temporary accounts regularly get deleted.

After readyCallback() or ready event fires storage has following properties:

name - Account owner name

key - Account master key

rsaPrivateKey - RSA private Key

sid - Current session ID

files - Hash of File objects by node ID-s.

root - File object for Cloud Drive main directory

trash - File object for Rubbish bin

inbox - File object for Inbox

mounts - Array of all top level directories

storage.upload(options | name, [buffer], [cb])

fs.createReadStream('myfile.txt').pipe(storage.upload('myfile.txt'))

Upload a file to Mega. You can pass in buffer data or just pipe data into it. Callback returns uploaded file object. If you don't specify callback you can listen for complete event to get the file handle.

Supported options:

name - File name required

attributes - Object of file attributes.

size - File size. Note that because Mega's API needs final data length before uploading can start, streaming only fully works if you specify the size of your data. Otherwise it needs to first buffer your data to determine the size.

target - Target directory file object or node ID. Defaults to storage.root.

storage.mkdir(options | name, cb)

storage.mkdir('dirname', function(err, file) {
})

Supported options:

name - Directory name required

attributes - Object of file attributes.

target - Parent directory file object or node ID. Defaults to storage.root.

storage.reload(cb)

Reloads files tree. No need to call this if autoload is used.

Events:

These events fire on file changes when keepalive is used. The changes can be triggered from any session connected to the same account.

add - New file/dir was added. Parameters: file.

move - File was moved to another dir. Parameters: file, olddir.

delete - File was deleted. Parameters: file.

update - File was changed(renamed). Parameters: file.

mega.file(url | opt)

var file = mega.file('https://mega....')

Returns file object based on download URL or options. Options can be downloadId and key.

File

Properties:

name - File name

attributes - Object of attributes

size - File size

key - File key(buffer)

timestamp - File creation time

nodeId - File ID

downloadId - Link ID to file. Only if created from link.

directory - Boolean if file is directory.

children - Array of files for directories.

file.download([cb])

Read file contents.

file.download().pipe(fs.createWriteStream('myfile.txt'))

file.download(function(err, data) {
  // data is buffer
})

file.link([noKey], cb)

Make download link for a file.

file.link(function(err, url) {
  // url: https://mega.co.nz/#!downloadId!key
})

file.delete(cb)

Delete file permanently.

file.delete(function(err) {
  // deleted.
})

file.loadAttributes(cb)

Download and decrypt file attributes. Attributes normally contain file name("n"), but it seems you can put anything you want in there.

Only makes sense when file is created from download link with mega.file(url), otherwise attributes are already loaded/decrypted.

mega.file(url).loadAttributes(function(err, file) {
  // file.name
  // file.size
  // file.attributes
})

Events:

Same events as for Storage objects. Only trigger for a specific file.

move - File was moved to another dir. Parameters: olddir.

delete - File was deleted.

update - File was changed(renamed).

mega.encrypt([key]) / mega.decrypt(key)

Lower level duplex streams. These could be used if you want to do network traffic and crypto on different time.

Takes in encrypted file data and outputs decrypted data and vice versa. Also does MAC verification / generation.

Note that if you specify key for encrypt() it needs to be 192bit. Other 64bit are for the MAC. You can later read the full key from the key property of the stream.

mega's People

Contributors

tonistiigi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mega's Issues

length is undefined when request fail

Hi,

I have this exception when a request fail.

Message: Cannot read property 'length' of undefined
Stacktrace ---
TypeError: Cannot read property 'length' of undefined
at Request.API.request as _callback
at Request.init.self.callback (/node_modules/mega/node_modules/request/main.js:122:22)
at Request.EventEmitter.emit (events.js:96:17)
at ClientRequest.Request.init.self.clientErrorHandler (
/node_modules/mega/node_modules/request/main.js:225:10)
at ClientRequest.EventEmitter.emit (events.js:96:17)
at CleartextStream.socketCloseListener (http.js:1424:9)
at CleartextStream.EventEmitter.emit (events.js:126:20)
at SecurePair.destroy (tls.js:956:22)
at process.startup.processNextTick.process._tickCallback (node.js:245:9)
Regular Caught exception: {}

To quickly fix it, i just edited api.js.

// Some error codes are returned as num, some as array with number.
if (resp.length) resp = resp[0]

into

// Some error codes are returned as num, some as array with number.
if (resp != undefined && resp.length) resp = resp[0]

decode if of the file ?

hi

i search how to get the id of a file, i can get the key with

var node_crypto = require('crypto');

function d64(s) {
s += '=='.substr((2-s.length*3)&3)
s = s.replace(/-/g,'+').replace(/_/g,'/').replace(/,/g,'')
return new Buffer(s, 'base64')
}

function from256to128(s) {
var o = new Buffer(16)
for (var i = 0; i < 16; i++) {
o[i] = s[i] ^ s[i + 16]
}
return o
}

var file = {"h":"zR8niALR","p":"GJclVaKI","u":"65fYYu5ZLBU","t":0,"a":"p91p4G1aF4DSOUajkxGgTuJDBnGqXIa4XBNSkJu1zwkWjhS8iCZmdoCRWDX3ebmBDemU_VFYvoAGTq8mb6LtuQ","k":"GJclVaKI:vhe23fV90E6We7hrSzoXtZYafjBwjqYSQcAZOlrQGLo","s":2529042,"ts":1395678307};

var k0 = d64("AOUU-DEgRdg4Khd4zM7ndA"); // original folder key
var iv = Buffer(16);
iv.fill(0);

var k = d64(file.k.split(':')[1]);
var u = d64(file.h); // seems to be the id, i have yAlxkCRS when i do right click -> get link on this file in my account
var aes = node_crypto.createDecipheriv('aes-128-ecb', k0, Buffer(0));
aes.setAutoPadding(false);
var kfdec = aes.update(k).toString('base64').replace(/+/g,'-').replace(///g,'_').replace(/=/g,'');
var k2dec = from256to128(aes.update(k));

//print decoded key
console.log(kfdec)

// how to get the decoded u var ?
// goal is the get the same result than get link function in mega

getting download url

I'm trying to figure out the download link from the response object I got by uploading a new file but I couldn't. The downloadId and key seem to be undefined so I'm quite lost on how I can get the download url to save to my db for later use. Would you mind helping me with this? Thanks.
Below is the object i obtained in the callback from a new file upload.

File {
  downloadId: undefined,
  key: <Buffer 9a 7d d4 64 60 b3 dc 0e 9a af b7 57 bf bb 2e a2 20 d9 db 9e 4b 5f 4e 4e 26 5b c4 03 0c 84 0c 50>,
  api:
   API {
     keepalive: true,
     counterId: 5475797859,
     sid: 'oslNTjWt9ILEYYLtR4Dc-2lGb0pDRGhzUkJFb-6ZCNSQHyOOQGxpN7jRnw',
     _events: { sc: [Function] },
     _eventsCount: 1,
     sn:
      Request {
        domain: null,

        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        method: 'POST',
        callback: [Function],
        readable: true,
        writable: true,
        explicitMethod: true,
        _qs: [Object],
        _auth: [Object],
        _oauth: [Object],
        _multipart: [Object],
        _redirect: [Object],
        _tunnel: [Object],
        headers: [Object],
        setHeader: [Function],
        hasHeader: [Function],
        getHeader: [Function],
        removeHeader: [Function],
        localAddress: undefined,
        pool: {},
dests: [],
        __isRequestRequest: true,
        _callback: [Function],
        uri: [Object],
        proxy: null,
        tunnel: false,
        setHost: true,
        originalCookieHeader: undefined,
        _disableCookies: true,
        _jar: undefined,
        port: 80,
        host: 'w.api.mega.co.nz',
        path: '/A3k5qdmo5J6l_LRm6QNp7gcSRAE',
        httpModule: [Object],
        agentClass: [Object],
        agent: [Object],
        _started: true,
        href: 'http://w.api.mega.co.nz/A3k5qdmo5J6l_LRm6QNp7gcSRAE',
        req: [Object],
        ntick: true } },
  nodeId: 'TU0G0BzB',
  timestamp: 1483193929,
  type: 0,
  directory: false,
  size: 139775,
  attributes: { n: 'all_monster_are_human_hd_wallpaper__by_lupussmoth-d927b79.png' },
  name: 'all_monster_are_human_hd_wallpaper__by_lupussmoth-d927b79.png',
  parent:
   File {
     downloadId: undefined,
     key: undefined,
    api:
      API {
        keepalive: true,
        counterId: 5475797859,

        sid: 'oslNTjWt9ILEYYLtR4Dc-2lGb0pDRGhzUkJFb-6ZCNSQHyOOQGxpN7jRnw',
        _events: [Object],
        _eventsCount: 1,
        sn: [Object] },
     nodeId: 'fUdlEASK',
     timestamp: 1483187895,
     type: 2,
     directory: true,
     name: 'Cloud Drive',
     children:
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Circular] ] } }

Better documentation for common use case

One would want to use this module to navigate the folder structure on Mega. Currently I can authenticate just fine, but all I get is a listing of "Files" that I can't do anything with, like Cloud Drive. It doesn't look like I can navigate the drive at all. How do I "enter" a folder and get a list of the files inside, eventually deciding which ones I want to download?

I think this use case should be added to the docs too.

Length of undefined in api.js

Hi,

I got this error, sometimes.

Message: Cannot read property 'length' of undefined

Stacktrace -
TypeError: Cannot read property 'length' of undefined
at Request._callback (/node_modules/mega/lib/api.js:56:13)
at Request.self.callback (
/node_modules/request/index.js:148:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request. (/node_modules/request/index.js:876:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (
/node_modules/request/index.js:827:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:910:16
at process._tickCallback (node.js:415:13)

It seems that even if there is no error, "resp" can be undefined.

mkdir function

Hi tonistiigi, I'm using your library and is great but I need create directories and I see that this is a missing function.

Do you know if exists another way to create a directory using you library?

Sorry for my english, thanks!

Progress bar

Hi mate, can you help me or explain me how to do a progress bar or show how many bits already have been downloaded?

Thanks.

keep getting "Wrong URL supplied."

Whatever I try to do in order to download a file from Mega, it keeps failing with "Wrong URL supplied" at this point:

const file = mega.file('https://mega.nz/file/........etc');

Any fix for that?

Trying to make a steaming service

Hi.
Excuse my bad english, I'm french.

I'm trying to make a streaming service with node and VLC web plugin.

var mega = require('mega');
var express = require('express');
var app = express();
var server = require('http').createServer(app);

server.listen(8000);
app.get('/stream/:hash!:key', stream);

function stream(req, res)
{
    var hash = req.param('hash');
    var key = req.param('key');
    var file = mega.file('https://mega.co.nz/#!'+hash+'!'+key)

    file.download().pipe(res);
}

I got some errors

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.EventEmitter.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:653:33)
    at Socket.EventEmitter.once (events.js:179:8)
    at TCP.onread (net.js:527:26)

TypeError: Cannot read property 'length' of undefined
    at Request._callback (/home/sites/megastream_nodejs/node_modules/mega/lib/api.js:54:13)
    at self.callback (/home/sites/megastream_nodejs/node_modules/mega/node_modules/request/main.js:122:22)
    at Request.EventEmitter.emit (events.js:95:17)
    at ClientRequest.self.clientErrorHandler (/home/sites/megastream_nodejs/node_modules/mega/node_modules/request/main.js:225:10)
    at ClientRequest.EventEmitter.emit (events.js:95:17)
    at CleartextStream.socketCloseListener (http.js:1475:9)
    at CleartextStream.EventEmitter.emit (events.js:117:20)
    at tls.js:616:10
    at process._tickCallback (node.js:415:13)

The streaming works.
But after the first warning, my memory increase very fast, and when it reach 1GB (I have 4GB of ram), the script crash with the last error (TypeError: Cannot read property 'length' of undefined).

What can I do about it ?

Erro at mega() in crypto in Node.js 11.15.0

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 9. Received 12
    at boundsError (internal/buffer.js:50:9)
    at Buffer.readInt32BE (internal/buffer.js:370:5)
    at Object.exports.prepareKey (/home/ricardo/Repositorios/cesta/scripts/node_modules/mega/lib/crypto/index.js:35:24)
    at new Storage (/home/ricardo/Repositorios/cesta/scripts/node_modules/mega/lib/storage.js:75:21)
    at mega (/home/ricardo/Repositorios/cesta/scripts/node_modules/mega/lib/mega.js:9:10)
    at Promise (/home/ricardo/Repositorios/cesta/scripts/utils/mega-upload.js:7:29)
    at new Promise (<anonymous>)
    at Function.execute (/home/ricardo/Repositorios/cesta/scripts/utils/mega-upload.js:6:16)
    at uploadFile (/home/ricardo/Repositorios/cesta/scripts/backup/index.js:65:39)
    at init (/home/ricardo/Repositorios/cesta/scripts/backup/index.js:105:15)
let mega = require('mega');
const storage = mega({email: "MY EMAIL" , password: 'MY PASSWORD', autoload:false}, function(err) {
});

Dont matter what account I using, this erro always appear.

Can anyone help me with this ? And also, if you have other lib to upload a file to Mega, I will be glad too

TypeError: Cannot read property 'children' of undefined

chrome latest... "version": "0.0.9",

F:\html5\mega\node_modules\mega-master>node example\list [email protected] *passwrd

F:\html5\mega\node_modules\mega-master\lib\storage.js:246
if (!parent.children) parent.children = []
^
TypeError: Cannot read property 'children' of undefined
at Storage._importFile (F:\html5\mega\node_modules\mega-master\lib\storage.j
s:246:18)
at Array.forEach (native)
at Storage.reload.api.on.deleted (F:\html5\mega\node_modules\mega-master\lib
\storage.js:174:16)
at Request.API.request [as _callback](F:html5meganode_modulesmega-maste
rlibapi.js:72:5)
at Request.init.self.callback (F:\html5\mega\node_modules\mega-master\node_m
odules\request\main.js:122:22)
at Request.EventEmitter.emit (events.js:99:17)
at Request. (F:\html5\mega\node_modules\mega-master\node_modules
request\main.js:661:16)
at Request.EventEmitter.emit (events.js:126:20)
at IncomingMessage.Request.start.self.req.self.httpModule.request.buffer (F:
\html5\mega\node_modules\mega-master\node_modules\request\main.js:623:14)
at IncomingMessage.EventEmitter.emit (events.js:126:20)

Wrong URL supplied

mega.js

  "use strict";

  let mega = require('mega')
  let file = mega.file("https://mega.nz/#!hR0zARiS")

  console.log(file)

What is wrong? I tried with decoding key too :(

Cannot upload file to a folder

I'm trying to upload a file to a folder:

var folder = mega.file('https://mega.co.nz/#F!rBtmGBLL!EfKQouVq4z1TjzFKI1oerA');
var up = storage.upload({
        name: path.basename(filepath),
        size: fs.statSync(filepath).size, // removing this causes data buffering.
        target: folder
    },
    // fs.readFileSync(filepath),
    function(err, file) {
        if (err) throw err
        console.log('\nUploaded', file.name, file.size + 'B')

        file.link(function(err, link) {
            if (err) throw err
            console.log('Download from:', link)
        })
    })

fs.createReadStream(filepath).pipe(up)

and i got this error:

Error: EARGS (-2): You have passed invalid arguments to this command.
    at Request._callback (C:\Users\chin\node_modules\mega\lib\api.js:69:13)
    at Request.self.callback (C:\Users\chin\node_modules\mega\node_modules\request\request.js:373:22)
    at Request.emit (events.js:98:17)
    at Request.<anonymous> (C:\Users\chin\node_modules\mega\node_modules\request\request.js:1318:14)
    at Request.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (C:\Users\chin\node_modules\mega\node_modules\request\request.js:1266:12)
    at IncomingMessage.emit (events.js:117:20)
    at _stream_readable.js:943:16
    at process._tickCallback (node.js:419:13)

firefox error with browserify

hi :)

there s a problem with the demo page and firefox

error

InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable

coming from

self.xhr.responseType = 'arraybuffer'

the download works if i comment this line then i have

TypeError: buf.copy is not a function

when the download end

thanks :)

ps: no problems on chrome

hostname instate of host ?

"version": "0.0.9"

Hi, first of all, thanks for your module ! And sorry for my bad english.

When i do something with an url like "mega.co.nz:443/#hash!hash" (i need to use :port in url for some reasons), it says "Wrong URL Supplied".

It is because in /lib/mega.js near line 19, you use ".host" instate of ".hostname"

// "mega.co.nz:443" !== "mega.co.nz"
if (url.host !== 'mega.co.nz' || !url.hash

But if we do
// "mega.co.nz" !== "mega.co.nz"
if (url.hostname !== 'mega.co.nz' || !url.hash

It works :)

get file from direct http://gfs204n006.userstorage.mega.co.nz/dl/xxxx--xxxx from megacrypter api

hi

first thanks for your module, works great with mega.co (normal) links

everything is in the title ?

i have some links from megacrypter i can get userstorage links from their api but how can i use your module after that to get file and downlaod functions ?

thanks a lot

ps: exemple of megacrypter link...

http://megacrypter.com/!0AP70UHmrBvTv5hPSQqEiBhz6cEibrAutVcSF0gzSI8OK0NxnReWvl-SuuabQJy5PsE7LD1SJ3UP68l_Q6O98G2raDAe7WuXi_dXHJiFk57vlPPM3hvvAGhioBSP1L-TyGqOetgKFRGdy0IWablyuUbX-rrR3ChvCha6LzUXc0I!3cf3b170

No way to delete file example storage.delete.

You can only delete a file that you downloaded from mega.co.nz by using file.delete but you can't delete a file on mega.co.nz that is on the site. You can't delete it, you can upload using storage.Upload but

Cannot read property 'length' of undefined (storage.js)

Hi,

I have an exception when sometimes, a request fail in storage.js

Message: Cannot read property 'length' of undefined

TypeError: Cannot read property 'length' of undefined
at Object.exports.d64 (/node_modules/mega/lib/crypto/index.js:17:24)
at Storage._createUser (
/node_modules/mega/lib/storage.js:151:22)
at Request.API.request as _callback

I think that we need to throw an error or check if "response.tsid" exists in storage.js at line 151 :

(storage.js near line 151)
self.api.request({a: 'us', user: user}, function(err, response) {
// maybe add "if(err) cb(err)" here
var t = crypto.d64(response.tsid) // here, response.tsid is undefined

Thanks !

Memory quota exceeding on heroku

Trying to use this sdk on heroku, where the memory limit is 512 MB on free dynos. Getting this error in the logs. The first few lines are application metrics, which indicate the memory usage, and the last two lines are the errors.

2015-10-20T18:32:41.148711+00:00 heroku[web.1]: 
source=web.1 dyno=heroku.42704105.f21ba872-0746-4bf5-be7c-d35b344955ea
sample#memory_total=518.14MB sample#memory_rss=120.08MB
sample#memory_cache=391.92MB sample#memory_swap=6.14MB
sample#memory_pgpgin=334805pages sample#memory_pgpgout=206288pages

2015-10-20T18:32:41.148711+00:00 heroku[web.1]: Process running mem=518M(101.2%)
2015-10-20T18:32:41.148711+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)

What I'm basically trying to do in my app is download a file from a remote server and upload it to MEGA. This error occurs after the uploading starts. I've used memwatch to check for memory leaks, but there aren't any. I'm not sure how to approach this problem since I'm new to node.js. Would appreciate any help on this. Thanks in advance.

License?

Can you add a license txt or md file ?

"crypto" throws RangeError by just trying to log in with username and password

Creating storage...
Warning: new Storage(email, password) is deprecated!
internal/buffer.js:77
throw new ERR_OUT_OF_RANGE(type || 'offset',
^

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 9. Received 12
at boundsError (internal/buffer.js:77:9)
at Buffer.readInt32BE (internal/buffer.js:473:5)
at Object.exports.prepareKey (A:\Desktop\AppTest\CodeTesting\node_modules\mega\lib\crypto\index.js:35:24)
at new Storage (A:\Desktop\AppTest\CodeTesting\node_modules\mega\lib\storage.js:75:21)
at mega (A:\Desktop\AppTest\CodeTesting\node_modules\mega\lib\mega.js:9:10)
at Object. (A:\Desktop\AppTest\CodeTesting\Utility_tool\megamaps.js:4:15)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14) {
code: 'ERR_OUT_OF_RANGE'
}

Shared folder

Hi,

I'm trying the demo and run like a charme. Very good jod.
But if someone have shared a folder with me, the demo script don't connect with my acccount and i can't see any files.

Socket error when upload a file

mega-master: node example/upload [my_email] [my_pass] readme.md
Uploading [=================================================] 100% 0.0s
Uploaded readme.md 5220B
Download from: https://mega.co.nz/[...]
mega-master:  ls
example           lib               node_modules      package.json      pan_con_queso.txt readme.md         test
mega-master:  node example/upload [my_email] [my_pass] pan_con_queso.txt 
Uploading [-------------------------------------------------] 0% NaNs
/Users/eseceve/Downloads/mega-master/example/upload.js:27
    if (err) throw err
                   ^
Error: socket hang up
    at createHangUpError (http.js:1253:15)
    at Socket.socketOnEnd [as onend] (http.js:1341:23)
    at TCP.onread (net.js:419:26)

loadAttributes fail

hi

don t know if mega made an update but some links can t be decoded

File.prototype._setAttributes = function(at, cb) seems not working (sorry for file linked but can t find samll exemple file with this error)

exemple #!Vs4XxRRD!cK_gNBp-7SYmr-riEqcgRiUqllsIcShTo2yDyEahdwE

give:
undefined
SyntaxError {} undefined

thanks

Download doesn't work

Hi.

With node v0.10.2 :

var mega = require('mega')
var fs = require('fs')

var file = mega.file('mp3 link file');

file.download().pipe(fs.createWriteStream('myfile.mp3'));

The MP3 file is corrupt. I cant listen it.

Trying to read beyond buffer length

Hi,

I'm getting the following error once I try to upload something via your example/upload file.

assert.js:102
  throw new assert.AssertionError({
        ^
AssertionError: Trying to read beyond buffer length
    at readUInt32 (buffer.js:649:12)
    at Buffer.readUInt32BE (buffer.js:673:10)
    at AES.decryptCBC (/Obfuscated/node_modules/mega/lib/crypto/index.js:78:21)
    at File._setAttributes (/Obfuscated/node_modules/mega/lib/file.js:67:28)
    at new File (/Obfuscated/node_modules/mega/lib/file.js:27:23)
    at Storage._importFile (/Obfuscated/node_modules/mega/lib/storage.js:229:32)
    at Array.forEach (native)
    at Storage.reload.api.on.deleted (/Obfuscated/node_modules/mega/lib/storage.js:175:16)
    at Request.API.request [as _callback] (/Obfuscated/node_modules/mega/lib/api.js:76:5)
    at Request.init.self.callback (/Obfuscated/node_modules/mega/node_modules/request/request.js:121:22)

Any clue how to solve it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.