@@ -120,46 +120,46 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
120
120
{% for parameter in method .parameters .all %}
121
121
{% if parameter .isUploadID %}
122
122
if({{ parameter .name | caseCamel | escapeKeyword }} != 'unique()') {
123
- try {
124
- response = await client.call('get', path + '/' + {{ parameter .name }}, headers);
125
- counter = response.chunksUploaded;
126
- } catch(e) {
127
- }
123
+ try {
124
+ response = await client.call('get', path + '/' + {{ parameter .name }}, headers);
125
+ counter = response.chunksUploaded;
126
+ } catch(e) {
127
+ }
128
128
}
129
129
{% endif %}
130
130
{% endfor %}
131
131
132
132
for (counter; counter < totalCounters; counter++) {
133
- const start = (counter * libClient.CHUNK_SIZE);
134
- const end = Math.min((((counter * libClient.CHUNK_SIZE) + libClient.CHUNK_SIZE) - 1), size);
135
-
136
- headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size;
137
-
138
- if (id) {
139
- headers['x-appwrite-id'] = id;
140
- }
141
-
142
- const stream = fs.createReadStream(streamFilePath, {
143
- start,
144
- end
133
+ const start = (counter * libClient.CHUNK_SIZE);
134
+ const end = Math.min((((counter * libClient.CHUNK_SIZE) + libClient.CHUNK_SIZE) - 1), size);
135
+
136
+ headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size;
137
+
138
+ if (id) {
139
+ headers['x-appwrite-id'] = id;
140
+ }
141
+
142
+ const stream = fs.createReadStream(streamFilePath, {
143
+ start,
144
+ end
145
+ });
146
+ payload['{{ parameter .name }}'] = stream;
147
+
148
+ response = await client.call('{{ method .method | caseLower }}', path, headers, payload{% if method .type == ' location' %}, 'arraybuffer'{% endif %});
149
+
150
+ if (!id) {
151
+ id = response['$id'];
152
+ }
153
+
154
+ if (onProgress !== null) {
155
+ onProgress({
156
+ $id: response['$id'],
157
+ progress: Math.min((counter+1) * libClient.CHUNK_SIZE, size) / size * 100,
158
+ sizeUploaded: end+1,
159
+ chunksTotal: response['chunksTotal'],
160
+ chunksUploaded: response['chunksUploaded']
145
161
});
146
- payload['{{ parameter .name }}'] = stream;
147
-
148
- response = await client.call('{{ method .method | caseLower }}', path, headers, payload{% if method .type == ' location' %}, 'arraybuffer'{% endif %});
149
-
150
- if (!id) {
151
- id = response['$id'];
152
- }
153
-
154
- if (onProgress !== null) {
155
- onProgress({
156
- $id: response['$id'],
157
- progress: Math.min((counter+1) * libClient.CHUNK_SIZE, size) / size * 100,
158
- sizeUploaded: end+1,
159
- chunksTotal: response['chunksTotal'],
160
- chunksUploaded: response['chunksUploaded']
161
- });
162
- }
162
+ }
163
163
}
164
164
}
165
165
{% endif %}
0 commit comments