Created
June 6, 2014 11:13
-
-
Save melvincarvalho/f87940fedcc43bcd98f9 to your computer and use it in GitHub Desktop.
PUT a file to a data space
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 https = require('https'); | |
var fs = require("fs"); | |
var options = { | |
host: 'domain_name', | |
port: 443, | |
path: 'path_to_file', | |
method: 'PUT', | |
key: fs.readFileSync("path_to_key.key"), | |
cert: fs.readFileSync("path_to_cert.crt"), | |
headers: { 'content-type': 'text/turtle' } | |
}; | |
var req = https.request(options, function(res) { | |
console.log("statusCode: ", res.statusCode); | |
console.log("headers: ", res.headers); | |
res.on('data', function(d) { | |
process.stdout.write(d); | |
}); | |
}); | |
req.write('<> <> <> .'); | |
req.end(); | |
req.on('error', function(e) { | |
console.error(e); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment