@enplug/scripts 1.11.4-dev17 → 1.11.4-dev18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const axios = require('axios');
|
|
2
2
|
const chalk = require('chalk');
|
|
3
3
|
const fs = require('fs');
|
|
4
|
+
const Blob = require('buffer')
|
|
4
5
|
const FormData = require('form-data');
|
|
5
6
|
const inquirer = require('inquirer');
|
|
6
7
|
const loadDevPrivateFile = require('../loadDevPrivateFile');
|
|
@@ -109,11 +110,15 @@ function getCrowdinConfig() {
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
function generateFormData(crowdinPath, localPath) {
|
|
113
|
+
// const reader = new FileReader();
|
|
114
|
+
const buffer = fs.readFileSync(localPath);
|
|
115
|
+
const blob = new Blob([buffer]);
|
|
116
|
+
console.log('blob',blob);
|
|
112
117
|
const formData = new FormData();
|
|
113
118
|
|
|
114
119
|
// formData.append('update_option', 'update_without_changes'); // Previous translations should remain valid
|
|
115
120
|
// formData.append('json', '');
|
|
116
|
-
formData.append('file',
|
|
121
|
+
formData.append('file', blob, 'en.json');
|
|
117
122
|
// formData.append(`export_patterns[${crowdinPath}]`, '%locale%.json');
|
|
118
123
|
return formData;
|
|
119
124
|
}
|