Categorygithub.com/opencoff/go-mmap
modulepackage
0.1.3
Repository: https://github.com/opencoff/go-mmap.git
Documentation: pkg.go.dev

# README

What is this

This is an OS independent mmap(2) abstractions.

How can I use it?

Here is an example program:


    // error checking omitted

    fd, _ := os.Open(filename)
    
    map := mmap.New(fd)

    // map the whole file as a RO mapping for sequential I/O
    p, err := map.Map(0, 0, mmap.PROT_READ, mmap.F_READAHEAD)
    if err != nil {
        ...
    }

    // p now represents the mapping of the entire file

    // buf represents the file contents as a byte slice
    buf := p.Bytes()
    ...

    p.Unmap()
    fd.Close()

# Functions

New creates a new memory map object for the given file.
NewAnon creates a mmemory map object suitable for anon mappings.
Reader mmap's chunks of the file and calls the given closure with successive chunks of the file contents until EOF.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
Mmap describes mappings for a file backed object.

# Type aliases

Flag describes additional properties for a given mapping.
Prot describes the protections for a mapping.