Skip to content

Qs-F/bort

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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