I know how to write file locally with fs.writeFile(). But how do I write/send a text file to sharepoint folder on a different server via node.js?
Asked
Active
Viewed 99 times
1 Answers
0
Dude, I don't know how sharepoint works, but if you want to a simple HTTP upload of a file from your file system, you can simply achieve that by by using module request
. For instance:
var request = require("request");
var fs = require("fs");
var req = request.post("http://sharepoint_url", function (err, resp, body) {
if (err) {
console.log('Error!');
} else {
console.log('URL: ' + body);
}
});
var form = req.form();
form.append('file', fs.createReadStream("your_filename_here"));

Eduardo Pereira
- 840
- 1
- 8
- 19