buildfree 1.0.0 → 1.0.1
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.
- package/package.json +4 -6
- package/src/forms.js +17 -19
package/package.json
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "buildfree",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Official JavaScript SDK for buildfree",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"dev": ""
|
|
7
|
+
"start":"node src/index.js",
|
|
8
|
+
"dev":"nodemon src/index.js"
|
|
10
9
|
},
|
|
11
10
|
"keywords": [],
|
|
12
11
|
"author": "BuildFree",
|
|
13
12
|
"license": "MIT",
|
|
14
13
|
"dependencies": {
|
|
15
|
-
"axios": "^1.20.0"
|
|
16
|
-
"nodemon": "^3.1.14"
|
|
14
|
+
"axios": "^1.20.0"
|
|
17
15
|
}
|
|
18
16
|
}
|
package/src/forms.js
CHANGED
|
@@ -167,7 +167,7 @@ class Forms {
|
|
|
167
167
|
// BUFFER
|
|
168
168
|
// ------------------------------------------------------
|
|
169
169
|
|
|
170
|
-
if (Buffer.isBuffer(file.buffer)) {
|
|
170
|
+
if (file.buffer && Buffer.isBuffer(file.buffer)) {
|
|
171
171
|
|
|
172
172
|
formData.append(
|
|
173
173
|
|
|
@@ -199,25 +199,23 @@ class Forms {
|
|
|
199
199
|
|
|
200
200
|
if (file.path) {
|
|
201
201
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
file.fieldname,
|
|
205
|
-
|
|
206
|
-
fs.createReadStream(
|
|
207
|
-
file.path
|
|
208
|
-
),
|
|
209
|
-
|
|
210
|
-
{
|
|
211
|
-
filename:
|
|
212
|
-
file.filename ||
|
|
213
|
-
file.originalname
|
|
202
|
+
if (!fs.existsSync(file.path)) {
|
|
203
|
+
throw new Error(`File not found: ${file.path}`);
|
|
214
204
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
205
|
+
|
|
206
|
+
formData.append(
|
|
207
|
+
file.fieldname,
|
|
208
|
+
fs.createReadStream(file.path),
|
|
209
|
+
{
|
|
210
|
+
filename:
|
|
211
|
+
file.filename ||
|
|
212
|
+
file.originalname ||
|
|
213
|
+
file.path.split(/[\\/]/).pop()
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
221
219
|
|
|
222
220
|
|
|
223
221
|
throw new Error(
|