Module

Web.File.Blob

Package
purescript-web-file
Repository
purescript-web/purescript-web-file

#Blob Source

data Blob

#fromString Source

fromString :: String -> MediaType -> Blob

Creates a String with the given Mediatype For example:

myBlob = fromString (unsafeStringify { name: "Carl", age: 25 }) (MediaType "application/json")

#fromArray Source

fromArray :: Array String -> MediaType -> Blob

Creates a Blob from an Array of strings with the given Mediatype

#type_ Source

type_ :: Blob -> Maybe MediaType

MediaType of the data contained in the Blob. Returns Nothing if the MediaType is unknown.

#size Source

size :: Blob -> Number

The size (in bytes) of the data contained in the Blob.

#StartByte Source

newtype StartByte

An index into the Blob indicating the first byte to include in the new Blob. If you specify a negative value, it's treated as an offset from the end of the string toward the beginning. For example, -10 would be the 10th from last byte in the Blob. If you specify a value for start that is larger than the size of the source Blob, the returned Blob has size 0 and contains no data.

Constructors

#EndByte Source

newtype EndByte

An index into the Blob indicating the first byte that will not be included in the new Blob (i.e. the byte exactly at this index is not included). If you specify a negative value, it's treated as an offset from the end of the string toward the beginning. For example, -10 would be the 10th from last byte in the Blob. The default value is size.

Constructors

#ByteIdx Source

data ByteIdx

#idxFromInt Source

idxFromInt :: Int -> ByteIdx

Creates ByteIdx from Int value

#idxFromNumber Source

idxFromNumber :: Number -> ByteIdx

Creates ByteIdx from Number value using Math.round.

#slice Source

slice :: MediaType -> StartByte -> EndByte -> Blob -> Blob

Creates a new Blob object (with specified MediaType), containing the data in the specified range of bytes of the source Blob, by setting .

#slice' Source

slice' :: StartByte -> EndByte -> Blob -> Blob

Creates a new Blob object containing the data in the specified range of bytes of the source Blob.