FileReader

object FileReader

Given the id of a file input field that has had a file selected, this Cmd will read either an image or text file to return an HTMLImageElement or String respectively.

class Object
trait Matchable
class Any

Type members

Classlikes

enum Result[A]

Value members

Concrete methods

def read[F[_] : Async, Msg](fileInputFieldId: String)(resultToMessage: Result[Any] => Msg): Cmd[F, Msg]

Generic read function, you will need to cast the result to the type you're expecting. This is normal, and is because we are accessing unknown resources.

Generic read function, you will need to cast the result to the type you're expecting. This is normal, and is because we are accessing unknown resources.

def readImage[F[_] : Async, Msg](inputFieldId: String)(resultToMessage: Result[Image] => Msg): Cmd[F, Msg]

Reads an input file as an image

Reads an input file as an image

def readText[F[_] : Async, Msg](inputFieldId: String)(resultToMessage: Result[String] => Msg): Cmd[F, Msg]

Reads an input file as plain text

Reads an input file as plain text