Created
July 1, 2023 07:23
-
-
Save thisjt/4ae4c865f76fe74a985f48d1a13233f3 to your computer and use it in GitHub Desktop.
Function to Upload a (Zip) File to Dropbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Dropbox = require('dropbox').Dropbox | |
var accessToken = '##ACCESSTOKEN##' | |
var filename = 'fileToUpload.zip' | |
fs.readFile(filename, (err, data) => { | |
if(err) { | |
// handle error | |
return | |
} | |
(new Dropbox({ accessToken: accessToken })).filesUpload({ | |
contents: data, | |
path: '/'+filename, | |
autorename: false, | |
}).then(response => { | |
// handle success | |
console.log(response) | |
}).catch(err => { | |
// handle error | |
console.log(err) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment