Export (0) Print
Expand All

slice method

Returns a new Blob object with bytes ranging from its optional start parameter up to but not including its optional end parameter.

Internet Explorer 10

 

Syntax

var retVal = Blob.slice(start, end, contentType);

Parameters

start [in, optional]

Type: signed long long

The optional start parameter is a value for the start point of a slice call, and is treated as a byte-order position, with position 0 representing the first byte. If start is negative, it is treated as length + start, where length is the length of the file (this allows byte selection starting from the end of the file).

end [in, optional]

Type: signed long long

The optional end parameter is a value for the end point of a slice call. The returned slice of data is up to but does not include the end byte. If end is omitted, slice selects all bytes from the start position to the end of the file. If end is negative, it is treated as length + end, where length is the length of the file (this allows byte selection starting from the end of the file).

contentType [in, optional]

Type: DOMString

The optional contentType parameter is used to set a value (identical to one that is set with the HTTP/1.1 Content-Type header) on the Blob returned by the slice call.

retVal [out, retval]

Type: Blob

Remarks

The slice method returns a new Blob object with bytes ranging from the optional start parameter up to but not including the optional end parameter, and with a type attribute that is the value of the optional contentType parameter.

If it is not possible to obtain the object in the range specified, your application should throw the NotSupportedError exception.

For a code sample of the slice method, see Blob.

See also

Blob

 

 

Show:
© 2014 Microsoft