diff --git a/README.md b/README.md index 1f5396cf..fa3222aa 100644 --- a/README.md +++ b/README.md @@ -562,6 +562,33 @@ when isMainModule: zip_close(zip) ``` +#### [D](https://dlang.org) +> Third party binding: [thechampagne/zip-d](https://github.com/thechampagne/zip-d) + +```shell +$ dmd -L-lzip main.d +``` + +```d +extern(C) void* zip_open(const(char)* zipname, int level, char mode); +extern(C) void zip_close(void* zip); +extern(C) int zip_entry_open(void* zip, const(char)* entryname); +extern(C) int zip_entry_close(void* zip); +extern(C) int zip_entry_write(void* zip, const(void)* buf, size_t bufsize); + +void main() +{ + void* zip = zip_open("/tmp/d.zip", 6, 'w'); + scope(exit) zip_close(zip); + + zip_entry_open(zip, "test"); + scope(exit) zip_entry_close(zip); + + string content = "test content"; + zip_entry_write(zip, content.ptr, content.length); +} +``` + ### Check out more cool projects which use this library * [Filament](https://github.com/google/filament): Filament is a real-time physically based rendering engine for Android, iOS, Linux, macOS, Windows, and WebGL. It is designed to be as small as possible and as efficient as possible on Android.