Skip to content

Commit

Permalink
Release v0.9.0-beta11 with gz wrapping of tar
Browse files Browse the repository at this point in the history
  • Loading branch information
luposlip committed Jun 4, 2024
1 parent 28b25d8 commit b99cc70
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ All notable changes to this project will be documented in this file. This change
- Timestamps for historical versions
- Optimize (speed+size of) low level index format

## [0.9.0-beta11] - 2024-06-04

### Enhanced

- Wrapping gz outputstream with tar outputstream for new fn tar-gz-outputstream

## [0.9.0-beta10] - 2024-05-29

### Enhanced
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# nd-db

```clojure
[com.luposlip/nd-db "0.9.0-beta10"]
[com.luposlip/nd-db "0.9.0-beta11"]
```

_Newline Delimited (read-only) Databases!_
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject com.luposlip/nd-db "0.9.0-beta10"
(defproject com.luposlip/nd-db "0.9.0-beta11"
:description "Clojure library to use newline delimited files as fast read-only databases."
:url "https://github.com/luposlip/nd-db"
:license {:name "Apache License, Version 2.0"
Expand Down
14 changes: 12 additions & 2 deletions src/nd_db/compress.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
[org.apache.commons.compress.archivers.tar
TarArchiveEntry TarArchiveOutputStream TarFile]
[org.apache.commons.compress.compressors
CompressorInputStream CompressorStreamFactory]))
CompressorInputStream CompressorStreamFactory]
[org.apache.commons.compress.compressors.gzip
GzipCompressorOutputStream]))

(defn compressed-input-stream ^CompressorInputStream [filename]
(let [in ^BufferedInputStream (io/input-stream filename)]
Expand All @@ -18,10 +20,18 @@
(let [out ^BufferedOutputStream (io/output-stream filename)]
(ZipArchiveOutputStream. out)))

(defn tar-output-stream ^TarArchiveOutputStream [filename]
(defn tar-output-stream "Creates an uncompressed tar ball"
^TarArchiveOutputStream [filename]
(let [out ^BufferedOutputStream (io/output-stream filename)]
(TarArchiveOutputStream. out)))

(defn tar-gz-output-stream
"Creates a compressed TAR ball"
^TarArchiveOutputStream [filename]
(let [bos ^BufferedOutputStream (io/output-stream filename)
gzo (GzipCompressorOutputStream. bos)]
(TarArchiveOutputStream. gzo)))

(defn write-zip-entry! [^ZipArchiveOutputStream zip-os ^"[B" bytes ^String entry-name]
(let [ze (ZipArchiveEntry. entry-name)]
(.setSize ze (count bytes))
Expand Down

0 comments on commit b99cc70

Please sign in to comment.