cpr.controls.UploadedFile

File object used in file upload

Index

Properties
Name Type Description
lastModified Number Returns the last modification time of the file as the millisecond difference from UNIX time (midnight on January 1, 1970).
name String Returns the name of the file referenced by the File object.
size Number Returns the size of File in bytes.
type String Returns the MIME type of File.
Methods
Name Return Type Description
arrayBuffer Promise<ArrayBuffer> Convert the File to a stream and read it to the end.
getProperty Object Returns the set property value.
slice Blob Returns a new Blob object containing data for the specified byte range from the source blob.
stream ReadableStream<Object> Convert File to ReadableStream.
text Promise<String> Convert the File to a stream and read it to the end.

Constructor

UploadedFile(properties)
Parameters
name type description
properties { name?: String, size?: Number, lastModified?: Number, type?: String, properties?: {[key:string]: Object} }

Properties

lastModified
type Number
readonly
Returns the last modification time of the file as the millisecond difference from UNIX time (midnight on January 1, 1970).
name
type String
readonly
Returns the name of the file referenced by the File object.
size
type Number
readonly
Returns the size of File in bytes.
type
type String
readonly
Returns the MIME type of File.

Methods

arrayBuffer()
Convert the File to a stream and read it to the end. Returns a Promise that transitions to an ArrayBuffer.
return Promise<ArrayBuffer>
getProperty(name)
Returns the set property value.
Parameters
name type description
name String
return Object
slice(start, end, contentType)
Returns a new Blob object containing data for the specified byte range from the source blob.
Parameters
name type description
startoptional Number
endoptional Number
contentTypeoptional String
return Blob
stream()
Convert File to ReadableStream. ReadableStream can be used to read the contents of a file.
return ReadableStream<Object>
text()
Convert the File to a stream and read it to the end. Returns a Promise that fulfills as a USVString.
return Promise<String>