thanks ๐... It's really hard to tell how popular core async is, some people swear by it and others seem to avoid it like the plague. I'll dig into using promesa, I was specifically thinking of core.async because it's transducer compatible, basically my thought process was build up a stack of xforms and then apply them. Perhaps I can do the same with promises? :thinking_face:
I think the description might not be absolutely accurate. So letโs imagine one is setting up user session data storage. Itโs empty. I will use load
to get data to the storage (obviously from some other storage like a file or a database). When I debug and want to get all data there, Iโll call dump
.
Oh nice, i'd been wondering about this. Always knew it would be possible, but wasn't sure if it existed.
i use both of them - i like core.async for stream-like things (e.g. a stream of events, or a stream of file buffers), but i find it awkward for promise-like things (e.g. a single http request)
basically i really like the manifold programming model, which uses both promises (aka Deferred
and Stream
together - and it's fine to use core.async
and promesa
together to similar effect in cljs, although you won't get the automatic glue that manifold gives you (e.g. a reduce
of a Stream
returns a Deferred
)
i'm currently working on a thing which will give you a manifold-like model, but cross-platform and with contextual programming benefits, but it's not going to be ready for a while yet
for file-handling my ideal API would be based around promises
, and where content streaming is required, promises
of core.async
chans
e.g. file/exists?
returns promise<bool>
, file/content-stream
returns promise<chan<buffer>>
Ah, that might not be a good fit then, the files in question are file objects that you would get from within a browser context of an upload or drag-n-drop event, so perhaps core.async
might be a better fit?
Those events give you individual files or an array of files
not sure without more details - but if you've got more detail i'm happy to give you my take
Sure ๐... Let me know what details you need and if the explanation that I give below is insufficient ๐... I've got lots of Files[0] and a stack of transforms that I run which I'm then using to create blobs[1]. I don't quite know what transforms I'm running until later, but sometimes I need information about the file contents to work that out. Then once I build the appropriate transform stack I then run all the transforms on the file contents to build a blob which I then use to trigger a download. My current approach is to just read the file contents and then use that to work everything out, but of course for large files you can't just do that because you'll crash the browser tab with an OOM. So I'm thinking can I build a xform of any transformations I want to run on the file and then apply them to the file in chunks, using slice, or just a stream. One potential bit of fiddliness is that I might have to do this more than once, as some intermediate steps towards building the xform may require me to run the current xform state across the whole file to work out what the next step is.:thinking_face: - [0]: https://developer.mozilla.org/en-US/docs/Web/API/File - [1]: https://developer.mozilla.org/en-US/docs/Web/API/Blob