README
This commit is contained in:
parent
fe76cd352c
commit
d0e7ad3fa1
1 changed files with 22 additions and 4 deletions
26
README.md
26
README.md
|
|
@ -862,6 +862,12 @@ user=> (hello "Alice")
|
||||||
"Hello Alice"
|
"Hello Alice"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Package babashka script as a AWS Lambda
|
||||||
|
|
||||||
|
AWS Lambda runtime doesn't support signals, therefore babashka has to disable
|
||||||
|
handling of the SIGPIPE. This can be done by setting
|
||||||
|
`BABASHKA_DISABLE_PIPE_SIGNAL_HANDLER` to `true`.
|
||||||
|
|
||||||
### Blogs
|
### Blogs
|
||||||
|
|
||||||
- [Babashka: a quick example](https://juxt.pro/blog/posts/babashka.html) by Malcolm Sparks
|
- [Babashka: a quick example](https://juxt.pro/blog/posts/babashka.html) by Malcolm Sparks
|
||||||
|
|
@ -1104,11 +1110,23 @@ $ docker run --rm script 1 2 3
|
||||||
Your command line args: (1 2 3)
|
Your command line args: (1 2 3)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Package babashka script as a AWS Lambda
|
### Extract single file from zip
|
||||||
|
|
||||||
AWS Lambda runtime doesn't support signals, therefore babashka has to disable
|
``` clojure
|
||||||
handling of the SIGPIPE. This can be done by setting
|
;; given the following zip file created as follows:
|
||||||
`BABASHKA_DISABLE_PIPE_SIGNAL_HANDLER` to `true`.
|
;; $ echo 'contents' > file
|
||||||
|
;; $ zip zipfile.zip file
|
||||||
|
;; $ rm file
|
||||||
|
;; we extract the single file from the zip using java.nio:
|
||||||
|
|
||||||
|
(import '[java.nio.file Files FileSystems CopyOption])
|
||||||
|
(let [zip-file (io/file "zipfile.zip")
|
||||||
|
file (io/file "file")
|
||||||
|
fs (FileSystems/newFileSystem (.toPath zip-file) nil)
|
||||||
|
file-in-zip (.getPath fs "file" (into-array String []))]
|
||||||
|
(Files/copy file-in-zip (.toPath file)
|
||||||
|
(into-array CopyOption [])))
|
||||||
|
```
|
||||||
|
|
||||||
## Thanks
|
## Thanks
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue