summaryrefslogtreecommitdiffstats
path: root/example_sync.nim
diff options
context:
space:
mode:
authorMilan Pässler <milan@petabyte.dev>2021-03-13 15:05:55 +0100
committerMilan Pässler <milan@petabyte.dev>2021-03-13 15:05:55 +0100
commit6c2b1b777bc3903930a7e28d0f5800c2e72ab2ab (patch)
tree6d5b4142f3abbde0f3e919330f19797b90f0f677 /example_sync.nim
parent55c1ef17b528b7892caba6a69f8e4d79bce2dd85 (diff)
downloadnimjpg-6c2b1b777bc3903930a7e28d0f5800c2e72ab2ab.tar.gz
nimjpg-6c2b1b777bc3903930a7e28d0f5800c2e72ab2ab.tar.bz2
nimjpg-6c2b1b777bc3903930a7e28d0f5800c2e72ab2ab.zip
multisync
Diffstat (limited to 'example_sync.nim')
-rw-r--r--example_sync.nim23
1 files changed, 23 insertions, 0 deletions
diff --git a/example_sync.nim b/example_sync.nim
new file mode 100644
index 0000000..d1f9b9f
--- /dev/null
+++ b/example_sync.nim
@@ -0,0 +1,23 @@
+import os
+import jpgnim
+import asyncdispatch
+import asyncfile
+import json
+
+var result: cint
+
+if paramCount() == 0:
+ echo "Gimme a file pls"
+ quit(QuitFailure)
+
+let path = paramStr(1)
+
+init_jpg()
+
+if fileExists(path):
+ let file = open(path)
+ echo pretty(%* collect_jpg(file))
+else:
+ echo "Gimme an existing file pls"
+
+deinit_jpg()