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: 20 modules, 17 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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