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)
I'm trying to upload a file to a folder:
and i got this error: