go_walk

package module
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 8 Imported by: 3

README

go-walk

A directory tree parser

Instillation

go get github.com/akshaybabloo/go-walk

Usage

package main

import (
    "fmt"
    walk "github.com/akshaybabloo/go-walk"
)

func main() {
    dirStats, err := walk.ListDirStat("/", "node_modules")
    if err != nil {
        panic(err)
    }
    fmt.Println(dirStats)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectoryInfo

type DirectoryInfo struct {
	Path            string    // Absolute path of the directory.
	Size            int64     // Size of the directory in bytes.
	LastModified    time.Time // When the directory was last modified.
	NumberOfFiles   int       // Number of files in the directory.
	NumberOfSubdirs int       // Number of subdirectories within the directory.
}

DirectoryInfo holds metadata about a directory.

func ListDirStat

func ListDirStat(dirPath string, keywords ...string) ([]DirectoryInfo, error)

ListDirStat lists directories matching the provided keywords in dirPath and returns their metadata. If no keywords are provided, all directories are matched. Returns aggregated errors if they occur.

type ErrorList added in v2.1.0

type ErrorList []error

ErrorList holds a list of errors.

func (ErrorList) Error added in v2.1.0

func (e ErrorList) Error() string

Error returns a string representation of the error list.

Jump to

Keyboard shortcuts

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