Created
July 1, 2015 12:25
-
-
Save karl-gustav/038f5212ca2c6a37c9b6 to your computer and use it in GitHub Desktop.
This file contains 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
'use strict'; | |
var fs = require('fs'), | |
request = require('request'), | |
crypto = require('crypto'), | |
filePath = __dirname + '/frontend-src/po/translation-blueprints.pot', | |
translationBlueprints = fs.readFileSync(filePath), | |
hash = crypto.createHash('md5').update(translationBlueprints).digest('hex'), | |
url = 'http://translations.fronter.net/zanata/rest/file/source/login-service/master?docId=translation-blueprints', | |
formData = { | |
hash: hash, | |
first: 'true', | |
last: 'true', | |
type: 'pot', | |
file: translationBlueprints | |
}, | |
headers = { | |
'X-Auth-User': 'kgr', | |
'X-Auth-Token': '12345678901234567890123456789012' | |
}; | |
request.post({ | |
url:url, | |
formData: formData, | |
headers: headers | |
}, function optionalCallback(err, httpResponse, body) { | |
if (err) { | |
return console.error('upload failed:', err); | |
} | |
console.log("httpResponse.statusCode:", httpResponse.statusCode); | |
console.log('Upload successful! Server responded with:', body); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Karl,
Saw your question in https://gitter.im/zanata/zanata. I've replied in https://gitter.im/zanata/zanata but you can also email us @ zanata-users@redhat.com.