Introducing isplaintextfile

Today we’re excited to announce the initial public release of isplaintextfile (v0.0.1), a lightweight Go library that helps developers determine whether files contain plaintext or binary data through intelligent content analysis.

Released on February 12, 2025, this first version establishes a clean, dependency-free foundation for plaintext detection in Go applications. Whether you’re building file processors, data validators, or content pipelines, isplaintextfile gives you a reliable tool to distinguish text from binary at your fingertips.

What’s New

As the inaugural release, v0.0.1 introduces the complete core functionality of the library:

Five Simple API Functions:

  • Bytes() - Check if in-memory byte data is plaintext
  • File() - Analyze an entire file for plaintext content
  • FilePreview() - Quickly check just the first N kilobytes of a file
  • Reader() - Validate plaintext status of streaming data
  • ReaderPreview() - Inspect the initial portion of any stream

Smart Detection That Just Works: The library uses UTF-8 validation and intelligent control character filtering to accurately identify text across multiple languages—including emoji, Chinese characters, and other multi-byte Unicode—while correctly rejecting binary content with null bytes and other non-text data.

Zero Dependencies: isplaintextfile relies entirely on Go’s standard library. No external packages to manage, no dependency conflicts to resolve—just pure plaintext detection logic you can trust.

Comprehensive Testing: From plain ASCII to large 23KB text files, from emoji-rich content to partial binary streams, the initial release ships with thorough test coverage ensuring the library behaves correctly across edge cases.

Why It Matters

In today’s data-intensive applications, knowing whether you’re dealing with text or binary isn’t just a nice-to-have—it’s often essential. File processors need to route content appropriately. Data pipelines must handle encoding correctly. Security tools need to identify potentially malicious binary payloads disguised as text.

isplaintextfile solves this problem elegantly by focusing on what matters: validating that content is proper UTF-8 while allowing common whitespace formatting (newlines, carriage returns, tabs) and rejecting problematic control characters. The result? A library that works reliably across international text, handles streaming data efficiently, and integrates seamlessly into any Go codebase.

The preview mode functions are particularly valuable for large files—inspect just the first few kilobytes to make quick determinations without reading gigabytes into memory. And with no external dependencies, you avoid the classic “dependency hell” that plagues many Go projects.

Get Started

Installing isplaintextfile is straightforward:

go get github.com/UnitVectorY-Labs/isplaintextfile@v0.0.1

Then import and use it in your code:

import "github.com/UnitVectorY-Labs/isplaintextfile"

// Check a file
if isplaintextfile.File("document.txt") {
    fmt.Println("This is plaintext!")
}

Requirements: Go 1.23.6 or later (as specified in the initial release). The library uses only standard library packages, so there are no additional dependencies to install.

What’s Next

This initial release lays the groundwork for future enhancements. As a v0.x release, it follows semantic versioning conventions where breaking changes may occur in subsequent minor versions. Stay tuned for updates as the library evolves based on user feedback and real-world usage patterns.

We’d like to thank JaredHatfield for creating this useful tool and making it available under the MIT license. The repository includes modern CI/CD practices including CodeQL security scanning, Zizmor GitHub Actions analysis, and Codecov integration—ensuring quality from day one.


This post was AI-generated using the unsloth/Qwen3.5-122B-A10B-GGUF:Q4_K_M model. It was generated on behalf of release-storyteller based on the v0.0.1 release published February 12, 2025 at the UnitVectorY-Labs/isplaintextfile repository.