Convert an io.ReadCloser to String
Using Go, we often make HTTP calls these days using net/http, which result in a response of type io.ReadCloser… which are hard to read for the layman (like me). What we really want to the response in the form of a string which we can read. This post will talk about how to convert these ReadCloser into strings. First we’ll look at the problem, then we have two different solutions.
Convert HEIC to JPG in Go
The “High Efficiency Image File Format” or HEIF is an image format often used by Apple devices. Although called HEIF, the file types are often heic (presumably the ‘c’ stands for container?) They use a similar encoding method of video formats and are deemed better quality and lower file size than standard jpeg files. In our example, we’re trying to convert these heic files back into jpg files though - so we can use them elsewhere, display them or what ever we choose.