-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from guzba/ryan
new in-memory createZipArchive
- Loading branch information
Showing
5 changed files
with
219 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
import test, test_known_bad, test_levels, test_tarballs, test_ziparchives | ||
import test, test_known_bad, test_levels, test_tarballs_read, test_ziparchives_read, test_ziparchives_write |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import std/os, zippy/ziparchives, std/tables, std/strutils | ||
|
||
when (NimMajor, NimMinor, NimPatch) >= (1, 6, 0): | ||
var entries: OrderedTable[string, string] | ||
entries["README.txt"] = "Hello, World!" | ||
|
||
let archive = createZipArchive(entries) | ||
echo archive.len | ||
# writeFile("tmp.zip", archive) | ||
|
||
# let reader = openZipArchive("tmp.zip") | ||
|
||
# try: | ||
# # Iterate over the paths in the zip archive. | ||
# for path in reader.walkFiles: | ||
# echo path | ||
|
||
# # # Extract a file from the archive. | ||
# # let contents = reader.extractFile("tmp.txt") | ||
# # echo contents.len | ||
# finally: | ||
# # Remember to close the reader when done. | ||
# reader.close() | ||
|
||
# var entries: OrderedTable[string, string] | ||
# for path in walkDirRec(getCurrentDir(), relative = true, skipSpecial = true): | ||
# if path.startsWith(".git"): | ||
# continue | ||
# if path.endsWith(".exe"): | ||
# continue | ||
# entries[path] = readFile(path) | ||
# writeFile("tmp.zip", createZipArchive(entries)) | ||
|
||
# let reader = openZipArchive("tmp.zip") | ||
|
||
# try: | ||
# # Iterate over the paths in the zip archive. | ||
# for path in reader.walkFiles: | ||
# echo path | ||
|
||
# finally: | ||
# # Remember to close the reader when done. | ||
# reader.close() |