2

Having a string like:

txt <- "0x1f8b0800000000000000ed3cdb72db38b2eff315..."

How can i read the content as plain text? If i interpret this question correctly that the string starts with 0x1f8b means that it is gziped...

I tried writing it and then reading it via

tmp <- tempfile()
writeLines(txt, tmp)
readLines(gzfile(tmp))

But this just returned the same string...

Community
  • 1
  • 1
Rentrop
  • 20,979
  • 10
  • 72
  • 100
  • 2
    Maybe write the binary represetation to a file and re-read it? What does `hex <- strsplit(gsub("(.{2})", "\\1 ", substr(txt, 3, nchar(txt))), " ", T)[[1]];raw <- as.raw(as.hexmode(hex));writeBin(raw, tmp <- tempfile(fileext = ".zip"))` yield? – lukeA Apr 23 '17 at 11:43
  • @lukeA Thats perfect. WOW! Thank you – Rentrop Apr 23 '17 at 11:55

0 Answers0