Interface UploadFileOptions

Allows customizing the fetch RequestInit options, as well as setting the type of response

interface UploadFileOptions {
    contentLength?: number;
    contentType?: string;
    defaultContentType?: string;
    disableExternalResources?: boolean;
    filename?: string;
    responseType?: ResponseType;
    throwHttpErrors?: boolean;
    useChunkedTransfer?: boolean;
}

Hierarchy (View Summary)

Properties

contentLength?: number

if content length is known this will avoid needing to detect it

contentType?: string

specify content type of video

defaultContentType?: string

Default content type to use if cannot be determined from input blob/filename

disableExternalResources?: boolean

Block any loads of external resources (file paths/network fetch). If true then you must explicitly pass in Flie/Blob or ReadableStreams

{false}
filename?: string

specify filename of video as reported to Rev

responseType?: ResponseType

specify body type when decoding. Use 'stream' to skip parsing body completely

Options are:

  • undefined (default): autodetect - object if json response (most common), text if text response type, otherwise a ReadableStream
  • 'json': return a json object (most common type of response)
  • 'text': return as string
  • 'blob': return as a Blob
  • 'stream': return the response.body as-is with no processing (may be NodeJS Readable if using node-fetch polyfill)
  • 'webstream': return response.body as a ReadableStream
  • 'nativestream': return response.body as a NodeJS Readable stream if using node, otherwise ReadableStream
throwHttpErrors?: boolean

whether to throw errors or not for HTTP error response codes.

true
useChunkedTransfer?: boolean

node-only - bypass dealing with content length and just upload as transfer-encoding: chunked