Note: This project is under active development and the API is subject to change.
Anki is a Go library for reading and writing Anki collection files. It aims to provide a simple and intuitive API that follows idiomatic Go practices.
- Full Read, Write, and Modify Capabilities: Unlike many other libraries that are read-only or write-only, this library provides a complete solution for reading, writing, and modifying Anki collections.
- Comprehensive Collection Management: Programmatically manage your Anki collections, including decks, notes, notetypes, cards, and media files.
- Seamlessly work with Anki Files: Work with Anki's
.apkgand.colpkgformats. - Flexibility: Whether you're building tools to automate card creation, exporting your collection to a different format, or analyzing your study habits, this library provides the foundation you need.
- Idiomatic Go: The library is designed to feel natural for Go developers, with a clean and easy-to-use API.
go get github.com/lftk/ankiThe examples directory contains code samples to help you get started with the library.
The basic example demonstrates the core functionality of the library, including:
- Creating a new collection
- Adding a deck
- Defining a custom notetype
- Adding new notes
- Saving the collection to an
.apkgfile
You can explore the code in examples/basic/main.go to see a complete, commented workflow.
For a complete list of available functions and types, please refer to the Go documentation.
For a simple command-line tool to unpack .apkg and .colpkg files, check out the companion project: anki-unpkg.
Contributions are welcome! Please feel free to submit a pull request or open an issue.
This project is licensed under the AGPL-3.0 License. See the LICENSE file for details.
This project is heavily inspired by and based on the official Anki ecosystem. A big thank you to the Ankitects team and all contributors for their tremendous work on the original software.