isBinaryContent: Determines if content appears to be text or binary

isBinaryContentR Documentation

Determines if content appears to be text or binary

Description

These functions attempt to guess if the content is binary or text by consulting the MIME type or the extension of the file name. These are made available via the package to allow others to use them when processing low-level HTTP responses.

Usage

isBinaryContent(header, type = getContentType(header)[1],
                textTypes = getOption("text.content.types", textContentTypes))

Arguments

header

the header from the HTTP response which delivered the content

type

the MIME type

textTypes

a character vector giving the MIME types that identify text content

Value

A logical value

Author(s)

Duncan Temple Lang

References

http://www.webmaster-toolkit.com/mime-types.shtml

See Also

getURLContent, dynCurlReader

Examples

  z = getURLContent("http://www.omegahat.org/RCurl/data.gz", header = TRUE)
  z$header["Content-Type"]
  isBinaryContent(  z$header["Content-Type"] )

  z = getURLContent("http://www.omegahat.org/RCurl/index.html", header = TRUE)
  z$header["Content-Type"]
  isBinaryContent(  z$header["Content-Type"] )

omegahat/RCurl documentation built on June 10, 2022, 12:34 p.m.