@@ -5,41 +5,41 @@ const { promisify } = require('util');
5
5
class InputFile {
6
6
stream; // Content of file, readable stream
7
7
size; // Total final size of the file content
8
- name ; // File name
8
+ filename ; // File name
9
9
10
- static fromPath = (filePath, name ) => {
10
+ static fromPath = (filePath, filename ) => {
11
11
const stream = fs.createReadStream(filePath);
12
12
const { size } = fs.statSync(filePath);
13
- return new InputFile(stream, name , size);
13
+ return new InputFile(stream, filename , size);
14
14
};
15
15
16
- static fromBuffer = (buffer, name ) => {
16
+ static fromBuffer = (buffer, filename ) => {
17
17
const stream = Readable.from(buffer.toString());
18
18
const size = Buffer.byteLength(buffer);
19
- return new InputFile(stream, name , size);
19
+ return new InputFile(stream, filename , size);
20
20
};
21
21
22
- static fromBlob = (blob, name ) => {
22
+ static fromBlob = (blob, filename ) => {
23
23
const buffer = blob.arrayBuffer();
24
24
const stream = Readable.from(buffer.toString());
25
25
const size = Buffer.byteLength(buffer);
26
- return new InputFile(stream, name );
26
+ return new InputFile(stream, filename );
27
27
};
28
28
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);
31
31
};
32
32
33
- static fromPlainText = (content, name ) => {
33
+ static fromPlainText = (content, filename ) => {
34
34
const buffer = Buffer.from(content, "utf-8");
35
35
const stream = Readable.from(buffer.toString());
36
36
const size = Buffer.byteLength(buffer);
37
- return new InputFile(stream, name , size);
37
+ return new InputFile(stream, filename , size);
38
38
};
39
39
40
- constructor(stream, name , size) {
40
+ constructor(stream, filename , size) {
41
41
this.stream = stream;
42
- this.name = name ;
42
+ this.filename = filename ;
43
43
this.size = size;
44
44
}
45
45
}
0 commit comments