assetfile

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 6 Imported by: ? modules, 0 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.

Documentation

Overview

Package assetfile opens the files assets load from: icons, images, stylesheets and fonts. It opens without blocking and checks the file it opened, so a named pipe, a device or a socket at an asset's path is an error rather than a read that never returns, and it bounds what it reads.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotRegular = errors.New("not a regular file")

ErrNotRegular is a path that names something other than a regular file.

View Source
var ErrTooLarge = errors.New("over the size limit")

ErrTooLarge is a file over the limit its asset kind allows.

Functions

func Open

func Open(path string, limit int64) (*os.File, int64, error)

Open opens path for reading without blocking on it, and returns the file with its size once fstat on that same descriptor shows a regular file of at most limit bytes. The caller closes the file.

func Read

func Read(path string, limit int64) ([]byte, error)

Read is the contents of the regular file at path, at most limit bytes, opened as Open opens it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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