Closed WojciechSoczynskiTHEY closed 1 week ago
The arguments align with the read(2)
system call. I'm uncertain if we should deviate from this approach. Here's an example to help you get started:
https://gist.github.com/kleisauke/2ee72c6788dfc12b463f10e5b8d6632f
Note that the ReadableStream
and WritableStream
overlay is still on the roadmap, see: https://github.com/kleisauke/wasm-vips/issues/59#issuecomment-1869496369.
Actually, you're right, this is a bit confusing to do in JavaScript. Commit 26aaa0c4b7801b1ee51c2f33048b8b41de95c1a0 avoids the need of pointer arguments in these callbacks. I've updated the previous linked gist to reflect this.
This will be in v0.0.11, thanks for reporting this!
v0.0.11 is now available.
LibVips offers since some time a way to provide a custom source. This is handy since it allows creating adapter for many different input methods e.g S3 byte ranges / streaming.
Unfortunately, the SourceCustom.onRead requires a pointer as the first argument to the handler.
The example on https://www.libvips.org/2019/11/29/True-streaming-for-libvips.html that is in Python shows how ideally that should work. Please note that the file here is only for demonstrative purposes and in a real world scenario that would be something completely dufferent.