
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
github.com/jimsmart/peanut
peanut is a Go package to write tagged data structs to disk in a variety of formats.
Its primary purpose is to provide a single consistent interface for easy, ceremony-free persistence of record-based struct data.
Each distinct struct type is written to an individual file (or table), automatically created, each named according to the name of the struct. Field/column names in each file/table are derived from struct tags. All writers use the same tags.
Currently supported formats are CSV, TSV, Excel (.xlsx), JSON Lines (JSONL), and SQLite. Additional writers are also provided to assist with testing and debugging. Mutiple writers can be combined using MultiWriter.
All writers perform atomic file operations, writing data to a temporary location and moving it to the final output location when Close is called.
When building an app or tool that needs to output data consisting of multiple different record types to disk, perhaps with requirements that change over time (whether during development or after initial deployment), perhaps requiring multiple output formats (during development/testing, or as final output) — is where peanut might be 'the right tool for the job'.
Ideal for use as an output solution for, e.g. data conversion tools, part of an ETL pipeline, data-acquistion or extraction tools/apps, web-scrapers, structured logging, persistence of captured data/metadata/events, job reporting, etc. Whether building an ad-hoc tool as a quick hack, or as part of a bigger, more serious project.
peanut initially evolved as part of a larger closed-source project, is tried and tested, and production-ready.
Get the package:
go get github.com/jimsmart/peanut
Use the package within your code:
import "github.com/jimsmart/peanut"
All peanut writers implement this interface:
type Writer interface {
Write(r interface{}) error
Close() error
Cancel() error
}
peanut.Writer
to use.Write()
to write records, repeating until done.Close()
to finish.See GoDocs.
GoDocs https://godoc.org/github.com/jimsmart/peanut
To run the tests execute go test
inside the project folder.
For a full coverage report, try:
go test -coverprofile=coverage.out && go tool cover -html=coverage.out
Package peanut is copyright 2020-2022 by Jim Smart and released under the BSD 3-Clause License.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.