Skip to content

Commit 89bf96a

Browse files
committed
Fixed indentation
1 parent 3f76c8e commit 89bf96a

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

templates/deno/src/services/service.ts.twig

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -116,58 +116,58 @@ export class {{ service.name | caseUcfirst }} extends Service {
116116
{% for parameter in method.parameters.all %}
117117
{% if parameter.isUploadID %}
118118
if({{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') {
119-
try {
120-
response = await this.client.call('get', path + '/' + {{ parameter.name }}, headers);
121-
counter = response.chunksUploaded;
122-
} catch(e) {
123-
}
119+
try {
120+
response = await this.client.call('get', path + '/' + {{ parameter.name }}, headers);
121+
counter = response.chunksUploaded;
122+
} catch(e) {
123+
}
124124
}
125125
{% endif %}
126126
{% endfor %}
127127

128128
for (counter; counter < totalCounters; counter++) {
129-
const start = (counter * Client.CHUNK_SIZE);
130-
const end = Math.min((((counter * Client.CHUNK_SIZE) + Client.CHUNK_SIZE) - 1), size);
131-
132-
headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size
133-
134-
if (id) {
135-
headers['x-{{spec.title | caseLower }}-id'] = id;
136-
}
137-
138-
const totalBuffer = new Uint8Array(Client.CHUNK_SIZE);
139-
140-
for (let blockIndex = 0; blockIndex < Client.CHUNK_SIZE / Client.DENO_READ_CHUNK_SIZE; blockIndex++) {
141-
const buf = new Uint8Array(Client.DENO_READ_CHUNK_SIZE);
142-
const cursorPosition = await Deno.seek(stream.rid, start + (blockIndex * 16384), Deno.SeekMode.Start);
143-
const numberOfBytesRead = await Deno.read(stream.rid, buf);
144-
145-
if (!numberOfBytesRead) {
146-
break;
147-
}
148-
149-
for (let byteIndex = 0; byteIndex < Client.DENO_READ_CHUNK_SIZE; byteIndex++) {
150-
totalBuffer[(blockIndex * Client.DENO_READ_CHUNK_SIZE) + byteIndex] = buf[byteIndex];
151-
}
152-
}
153-
154-
payload['{{ parameter.name }}'] = new File([totalBuffer], basename({{ parameter.name | caseCamel | escapeKeyword }}));
155-
156-
response = await this.client.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %});
157-
158-
if (!id) {
159-
id = response['$id'];
129+
const start = (counter * Client.CHUNK_SIZE);
130+
const end = Math.min((((counter * Client.CHUNK_SIZE) + Client.CHUNK_SIZE) - 1), size);
131+
132+
headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size
133+
134+
if (id) {
135+
headers['x-{{spec.title | caseLower }}-id'] = id;
136+
}
137+
138+
const totalBuffer = new Uint8Array(Client.CHUNK_SIZE);
139+
140+
for (let blockIndex = 0; blockIndex < Client.CHUNK_SIZE / Client.DENO_READ_CHUNK_SIZE; blockIndex++) {
141+
const buf = new Uint8Array(Client.DENO_READ_CHUNK_SIZE);
142+
const cursorPosition = await Deno.seek(stream.rid, start + (blockIndex * 16384), Deno.SeekMode.Start);
143+
const numberOfBytesRead = await Deno.read(stream.rid, buf);
144+
145+
if (!numberOfBytesRead) {
146+
break;
160147
}
161148

162-
if (onProgress !== null) {
163-
onProgress({
164-
$id: response['$id'],
165-
progress: Math.min((counter+1) * Client.CHUNK_SIZE, size) / size * 100,
166-
sizeUploaded: end+1,
167-
chunksTotal: response['chunksTotal'],
168-
chunksUploaded: response['chunksUploaded']
169-
});
149+
for (let byteIndex = 0; byteIndex < Client.DENO_READ_CHUNK_SIZE; byteIndex++) {
150+
totalBuffer[(blockIndex * Client.DENO_READ_CHUNK_SIZE) + byteIndex] = buf[byteIndex];
170151
}
152+
}
153+
154+
payload['{{ parameter.name }}'] = new File([totalBuffer], basename({{ parameter.name | caseCamel | escapeKeyword }}));
155+
156+
response = await this.client.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %});
157+
158+
if (!id) {
159+
id = response['$id'];
160+
}
161+
162+
if (onProgress !== null) {
163+
onProgress({
164+
$id: response['$id'],
165+
progress: Math.min((counter+1) * Client.CHUNK_SIZE, size) / size * 100,
166+
sizeUploaded: end+1,
167+
chunksTotal: response['chunksTotal'],
168+
chunksUploaded: response['chunksUploaded']
169+
});
170+
}
171171
}
172172

173173
return response;

0 commit comments

Comments
 (0)