cozy-stack icon indicating copy to clipboard operation
cozy-stack copied to clipboard

nsjail Versus wasm

Open gedw99 opened this issue 2 years ago • 3 comments

Wazero is a no cgo wasm runner and could replace nsjail

gedw99 avatar Jan 13 '23 06:01 gedw99

Hi @gedw99, I'd like to know more about that. We are using nsjail for running imagemagick and nodejs scripts.

For imagemagick, there is a wasm port (https://github.com/dlemstra/magick-wasm), but it didn't support reading PDF (https://github.com/dlemstra/magick-wasm/discussions/51), which is mandatory for us. Same for SVG: https://github.com/dlemstra/magick-wasm/discussions/19. Do you have another way to suggest?

For nodejs scripts, do you have any resource or link on how to compile JS to wasm?

nono avatar Jan 13 '23 08:01 nono

apologies for random thoughts but https://github.com/ncruces/dcraw https://github.com/jerbob92/go-pdfium-wasm might be cookie crumbs to find folks in similar situations about images and pdf support for their tools. in most cases there are ports to do. I don't have insight into compiling JS to wasm, but someone else may

codefromthecrypt avatar Feb 01 '23 14:02 codefromthecrypt

Will chime here …

sometimes it’s useful to step back and see the best path forward ..

Image transforms can be done in pure go compiled to wasm. Sure you might loose some speed but it’s really clean. There are plenty of golang packages that pretty much do what image magic does.

pdf. As @codefromthecrypt suggested. It works great. There is also pdfcpu which is pure golang .

Wazero is so simple to use and there are sone great golang systems built on top to make it very easy .

capsule is one on GitHub ..

gedw99 avatar Sep 11 '23 15:09 gedw99