@@ -12,31 +12,31 @@ const _bufferToString = (buffer: Uint8Array): ReadableStream<Uint8Array> => {
12
12
export class InputFile {
13
13
stream: ReadableStream<Uint8Array >; // Content of file as a stream
14
14
size: number; // Total final size of the file content
15
- name : string; // File name
15
+ filename : string; // File name
16
16
17
- static fromPath = (filePath: string, name : string): InputFile => {
17
+ static fromPath = (filePath: string, filename : string): InputFile => {
18
18
const file = Deno.openSync(filePath);
19
19
const stream = readableStreamFromReader(file);
20
20
const size = Deno.statSync(filePath).size;
21
- return new InputFile(stream, name , size);
21
+ return new InputFile(stream, filename , size);
22
22
};
23
23
24
- static fromBuffer = (buffer: Uint8Array, name : string): InputFile => {
24
+ static fromBuffer = (buffer: Uint8Array, filename : string): InputFile => {
25
25
const stream = _bufferToString(buffer);
26
26
const size = buffer.byteLength;
27
- return new InputFile(stream, name , size);
27
+ return new InputFile(stream, filename , size);
28
28
};
29
29
30
- static fromPlainText = (content: string, name : string): InputFile => {
30
+ static fromPlainText = (content: string, filename : string): InputFile => {
31
31
const buffer = new TextEncoder().encode(content);
32
32
const stream = _bufferToString(buffer);
33
33
const size = buffer.byteLength;
34
- return new InputFile(stream, name , size);
34
+ return new InputFile(stream, filename , size);
35
35
};
36
36
37
- constructor(stream: ReadableStream<Uint8Array >, name : string, size: number) {
37
+ constructor(stream: ReadableStream<Uint8Array >, filename : string, size: number) {
38
38
this.stream = stream;
39
- this.name = name ;
39
+ this.filename = filename ;
40
40
this.size = size;
41
41
}
42
42
}
0 commit comments