preallocate

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2019 License: MIT Imports: 6 Imported by: 2

README

preallocate

GoDoc builds.sr.ht status Donate

File preallocation library

Features

  • Allocates files efficiently (via syscall) on the following platforms:
  • Falls back to writing null bytes

Documentation

Docs are hosted on godoc.org.

Support

Issues and suggestions are hosted on todo.sr.ht.

Documentation

Overview

Package preallocate allocates disk space efficiently via syscall (on supported platforms and filesystems) or by writing null bytes.

Files opened with O_APPEND are not supported.

Index

Constants

View Source
const NullBufferSize = 512 * 1024 // 512 KiB

NullBufferSize determines the maximum size of NULL byte blocks written to files when falling back to WriteSeeker.

Variables

This section is empty.

Functions

func File

func File(file *os.File, size int64) error

File preallocates a file via syscall (when supported) or WriteSeeker.

func TempFile

func TempFile(dir string, pattern string, size int64) (*os.File, error)

TempFile preallocates a temporary file (see File and ioutil.TempFile).

func WriteSeeker

func WriteSeeker(w io.WriteSeeker, size int64) error

WriteSeeker preallocates an io.WriteSeeker by writing null bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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