Skip to content

Commit ef502e1

Browse files
committed
Fix node var names
1 parent 23a8945 commit ef502e1

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

templates/node/lib/inputFile.js.twig

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,41 @@ const { promisify } = require('util');
55
class InputFile {
66
stream; // Content of file, readable stream
77
size; // Total final size of the file content
8-
name; // File name
8+
filename; // File name
99

10-
static fromPath = (filePath, name) => {
10+
static fromPath = (filePath, filename) => {
1111
const stream = fs.createReadStream(filePath);
1212
const { size } = fs.statSync(filePath);
13-
return new InputFile(stream, name, size);
13+
return new InputFile(stream, filename, size);
1414
};
1515

16-
static fromBuffer = (buffer, name) => {
16+
static fromBuffer = (buffer, filename) => {
1717
const stream = Readable.from(buffer.toString());
1818
const size = Buffer.byteLength(buffer);
19-
return new InputFile(stream, name, size);
19+
return new InputFile(stream, filename, size);
2020
};
2121

22-
static fromBlob = (blob, name) => {
22+
static fromBlob = (blob, filename) => {
2323
const buffer = blob.arrayBuffer();
2424
const stream = Readable.from(buffer.toString());
2525
const size = Buffer.byteLength(buffer);
26-
return new InputFile(stream, name);
26+
return new InputFile(stream, filename);
2727
};
2828

29-
static fromStream = (stream, name, size) => {
30-
return new InputFile(stream, name, size);
29+
static fromStream = (stream, filename, size) => {
30+
return new InputFile(stream, filename, size);
3131
};
3232

33-
static fromPlainText = (content, name) => {
33+
static fromPlainText = (content, filename) => {
3434
const buffer = Buffer.from(content, "utf-8");
3535
const stream = Readable.from(buffer.toString());
3636
const size = Buffer.byteLength(buffer);
37-
return new InputFile(stream, name, size);
37+
return new InputFile(stream, filename, size);
3838
};
3939

40-
constructor(stream, name, size) {
40+
constructor(stream, filename, size) {
4141
this.stream = stream;
42-
this.name = name;
42+
this.filename = filename;
4343
this.size = size;
4444
}
4545
}

templates/node/lib/services/service.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class {{ service.name | caseUcfirst }} extends Service {
133133
}
134134

135135
const stream = Stream.Readable.from(currentChunk);
136-
payload['{{ parameter.name }}'] = { type: 'file', file: stream, filename: file.name };
136+
payload['{{ parameter.name }}'] = { type: 'file', file: stream, filename: file.filename };
137137

138138
response = await selfClient.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %});
139139

0 commit comments

Comments
 (0)