file

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package file provides an os.File-like interface of a memory mapped file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	io.ReaderAt
	io.ReaderFrom
	io.WriterAt
	io.WriterTo

	Close() error
	Stat() (os.FileInfo, error)
	Sync() error
	Truncate(int64) error
}

Interface is a os.File-like entity.

func Open

func Open(f *os.File) (Interface, error)

Open returns a new Interface backed by f, or an error, if any.

This function does not use memory mapped file I/O on Windows because there some methods, like Truncate, produce errors in the current implementation:

The requested operation cannot be performed on a file with a user-mapped section open.

Windows expert needed to fix this.

func OpenMem

func OpenMem(name string) (Interface, error)

OpenMem returns a new Interface, or an error, if any. The Interface content is volatile, it's backed only by process' memory.

Jump to

Keyboard shortcuts

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