Fork me on GitHub
#babashka
<
2020-11-02
>
borkdude10:11:34

Wrote down some notes on http client and server here: https://github.com/borkdude/babashka/issues/628

Darin Douglass14:11:11

> http-kit keeps the whole response in memory this kind of surprising to me. is this an artifact of the how it's implemented/added into bb? you should be able to use {:as :stream} to get a bytestream on any request

borkdude14:11:30

no, it's just how http-kit implemented it. it has nothing to do with bb

borkdude14:11:05

you will get the stream, but not until it's fully realized in memory first

Darin Douglass14:11:08

yeah i was just looking at that code

Darin Douglass14:11:19

that's kinda surprising, honestly. good find

borkdude14:11:14

But you can use babashka.curl for big streams. I hope it will get fixed eventually in http-kit but it's been like this for years apparently

borkdude16:11:36

This project works with bb: https://github.com/ordnungswidrig/sha-words It translates SHAs or UUIDs in human-readable words

lukasz16:11:42

wow, that's cool (the lib and BB support)

borkdude16:11:02

It just happened to work with bb, it wasn't designed like that btw :)

borkdude17:11:33

so, there is now a Raspberry Pi with 8GB of memory. Should be sufficient to get babashka compiling on such a machine https://www.raspberrypi.org/products/raspberry-pi-4-model-b/?resellerType=home

👍 12
isak17:11:45

Nice, I was going to ask. I've been using the jar on mine for now.

borkdude23:11:54

@mathpunk I saw a question about babashka.process, and I was going to give an example, but I saw you removed it. Posting it anyway.

user=> (def cat-proc (babashka.process/process ["cat"]))
#'user/cat-proc
user=> (def writer  (io/writer (:in cat-proc)))
#'user/writer
user=> (binding [*out* writer] (println "hello"))
nil
user=> (binding [*in* (io/reader (:out cat-proc))] (read-line))
"hello"

mathpunk23:11:30

oh thank you! i had a moment where i felt self-conscious and like i should go answer it via documentation

mathpunk23:11:40

this is very helpful thank you!

borkdude23:11:33

the last line shows how you can read lines from a process and wait for certain output

thanks2 3
lukasz23:11:28

Am I doing something wrong, is java.security.SecureRandom not in babashka? java.security.MessageDigest is included

lukasz23:11:30

Not a biggie of course, just checking