Writing bigarray to file

Dear camlers

There is no way to write a bigarray to a file (except in C or element by element) ? In my case, the file is a socket hence map_file is not an option.

Cheers,
Christophe

1 Like

Indeed, this operation is not available in the standard library. If you are dealing with a “char” bigarray, there are third-party libraries that will do what you want, eg ocaml-bigstring:

If you are dealing with a general bigarray, then you will need to work a bit harder by writing some C code yourself.

Cheers,
Nicolas

GitHub - inhabitedtype/bigstringaf: Bigstring intrinsics and fast blits based on memcpy/memmove is the maintained alternative to the ocaml-bigstring. I use it in production and it works great, can recommend.

I second bigstringaf, it’s better than bigstring :slight_smile:

1 Like