Skip to content

Instantly share code, notes, and snippets.

@karl-gustav
Created July 1, 2015 12:25
Show Gist options
  • Save karl-gustav/038f5212ca2c6a37c9b6 to your computer and use it in GitHub Desktop.
Save karl-gustav/038f5212ca2c6a37c9b6 to your computer and use it in GitHub Desktop.
'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);
});
@alex-sl-eng
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment