Created
August 30, 2020 07:44
-
-
Save tetrashine/0fa22bd9cd0890867b4c973a1db1be5b to your computer and use it in GitHub Desktop.
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
| const https = require("https"); | |
| fs = require('fs') | |
| fs.readFile('test.txt', 'utf8', function (err, data) { | |
| const req = https.request('https://content.dropboxapi.com/2/files/upload', { | |
| method: 'POST', | |
| headers: { | |
| 'Authorization': `Bearer ${TOKEN}`, | |
| 'Dropbox-API-Arg': JSON.stringify({ | |
| 'path': '/Upload/test.txt', | |
| 'mode': 'overwrite', | |
| 'autorename': true, | |
| 'mute': false, | |
| 'strict_conflict': false | |
| }), | |
| 'Content-Type': 'application/octet-stream', | |
| } | |
| }, (res) => { | |
| console.log("statusCode: ", res.statusCode); | |
| console.log("headers: ", res.headers); | |
| res.on('data', function(d) { | |
| process.stdout.write(d); | |
| }); | |
| }); | |
| req.write(data); | |
| req.end(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment