qcow2reader

package module
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 12 Imported by: 17

README

go-qcow2reader

Go Reference

go-qcow2reader provides io.ReaderAt for qcow2 images.

Use io.NewSectionReader to wrap io.ReaderAt into io.Reader:

f, _ := os.Open("a.qcow2")
defer f.Close()
img, _ := qcow2reader.Open(f)
r := io.NewSectionReader(img, 0, img.Size()))

Converting images

The convert package copies an image to an io.WriterAt, skipping unallocated and zero extents. The target can be a raw file, or a vhdx.Writer to create a dynamic VHDX image.

Zero ranges are skipped rather than written, so a raw target has to be sized by the caller:

f, _ := os.Create("a.raw")
defer f.Close()
_ = f.Truncate(img.Size())
_ = convert.Convert(f, img, convert.Options{})

A vhdx.Writer sizes its own file:

f, _ := os.Create("a.vhdx")
defer f.Close()
w, _ := vhdx.NewWriter(f, img.Size(), vhdx.WriterOptions{})
_ = convert.Convert(w, img, convert.Options{})
_ = w.Close()

Limitations

The following features are not supported yet:

The following features are experimentally supported:

Documentation

Index

Constants

This section is empty.

Variables

Types is the known image types.

Functions

func Open

func Open(ra io.ReaderAt) (image.Image, error)

Open opens an image.

func OpenWithType

func OpenWithType(ra io.ReaderAt, t image.Type) (image.Image, error)

OpenWithType open opens an image with the specified image.Type.

Types

This section is empty.

Directories

Path Synopsis
cmd
raw
vdi
vpc
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL