readdiriter

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 4 Imported by: 0

README

readdiriter PkgGoDev

readdiriter is a Go package which provides functions which returns an iterator over directory entries in the specified directory.

Documentation

Overview

Package readdiriter provides functions which return an iterator over directory entries in the specified directory.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReadDirIter

func NewReadDirIter(file fs.ReadDirFile, n int) iter.Seq2[fs.DirEntry, error]

NewReadDirIter returns an iterate over directory entries from the file parameter. The n parameter follows the semantics of fs.ReadDirFile: https://pkg.go.dev/io/fs@latest#ReadDirFile.

Example
file, err := os.Open(".")
if err != nil {
	log.Fatal(err)
}
defer file.Close()

// See https://pkg.go.dev/os@latest#File.ReadDir for n
const n = 0
for entry, err := range NewReadDirIter(file, n) {
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("entry=%+v", entry)
}

Types

This section is empty.

Directories

Path Synopsis
Package unixdirents provides functions which returns a iterator over directory entries in the specified directory on Unix platforms.
Package unixdirents provides functions which returns a iterator over directory entries in the specified directory on Unix platforms.

Jump to

Keyboard shortcuts

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