Skip to content

Commit 1a4f0e2

Browse files
committed
deprecate Component.file in favour of Component.blob
1 parent 660363b commit 1a4f0e2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ export class Component implements Part {
4343
}
4444

4545
/**
46-
* Create a Component from a {@link File}. If file media type is available,
46+
* Create a Component from a {@link !File}. If file media type is available,
4747
* it will be set in the `Content-Type` header. The file's contents will be used as the part's body.
4848
*
4949
* This method might be slow if a large file is provided as the file contents need to be read.
5050
*
5151
* @param file File instance to create the component from
52+
* @deprecated Use {@link Component.blob}.
5253
*/
5354
public static async file(file: File) {
54-
return new Component(file.type.length > 0 ? {"Content-Type": file.type} : {}, await file.arrayBuffer());
55+
return await Component.blob(file);
5556
}
5657

5758
/**

0 commit comments

Comments
 (0)