Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot upload file to a folder #25

Open
chinhodado opened this issue Jan 14, 2015 · 0 comments
Open

Cannot upload file to a folder #25

chinhodado opened this issue Jan 14, 2015 · 0 comments

Comments

@chinhodado
Copy link

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant