Skip to content
/ bort Public

Go package to classify input into binary and text (limited to UTF-8)

License

Notifications You must be signed in to change notification settings

Qs-F/bort

Repository files navigation

pkg bort

This package classify given data into binary and text (UTF-8 only)

Installation

go get github.com/Qs-F/bort

Usage

Example to classify data from stdin into binary data and text data

package main

import (
	"fmt"
	"os"

	"github.com/Qs-F/bort"
)

func main() {
	b, err := bort.IsBin(os.Stdin)
	if err != nil {
		fmt.Fprintf(os.Stderr, err.Error())
		return
	}

	if b {
		fmt.Println("binary")
	} else {
		fmt.Println("text")
	}
}

License

MIT License

About

Go package to classify input into binary and text (limited to UTF-8)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published