tail

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 5 Imported by: 0

README

tail

tail returns last n lines of file

Install

go get github.com/246859/tail@latest

Usage

package main

import (
	"fmt"
	"github.com/246859/tail"
	"log"
	"os"
)

func main() {
	file, err := os.Open("hello.txt")
	if err != nil {
		log.Fatal(err)
	}
	bytes, err := tail.Tail(file, 10)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(bytes)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tail

func Tail(file *os.File, n int) ([]byte, error)

Tail returns the last n lines of the file

func TailAt

func TailAt(file *os.File, n int, offset int64) ([]byte, int64, error)

TailAt returns the last n lines of the file, and the current offset of the file

func TailAtLines

func TailAtLines(file *os.File, n int, offset int64) ([][]byte, int64, error)

TailAtLines returns the byte slice that last n lines of the file, and the current offset of the file

func TailAtString

func TailAtString(file *os.File, n int, offset int64) (string, int64, error)

TailAtString returns the string representation that last n lines of the file, and the current offset of the file

func TailAtStringLines

func TailAtStringLines(file *os.File, n int, offset int64) ([]string, int64, error)

TailAtStringLines returns the string slice that last n lines of the file, and the current offset of the file

func TailLines

func TailLines(file *os.File, n int) ([][]byte, error)

TailLines returns bytes slice that last n lines of the file

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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