Home Reference Source
public class | source

FileController

Method Summary

Public Methods
public

Takes in a File object from browser, convert it to base64.

public

Get file type from a base64 string converted by getBase64FromFile.

Public Methods

public getBase64FromFile(file: File): Promise<string> source

Takes in a File object from browser, convert it to base64. This function only works if you are running this in a browser.

Params:

NameTypeAttributeDescription
file File

Return:

Promise<string>

public getFileTypeFromBase64(base64: string): string source

Get file type from a base64 string converted by getBase64FromFile. Must start with data:???/???;

Params:

NameTypeAttributeDescription
base64 string

Return:

string