R write in feather format to byte vector

In R, how can a data.frame be written to an in-memory raw byte vector in the feather format?

The arrow package has a write_feather function in which the destination can be an BufferedOutputStream, but the documentation doesn’t describe how to create such a stream or access its underlying buffer.

Other than that most other packages assume usage of a local file system rather than in-memory storage.

Thank you in advance for your consideration and response.

Upvotes: 0

Views: 292

Answers (1)

Neal Richardson
Neal Richardson

Reputation: 792

BufferOutputStream$create() is how you create one. You can pass that to write_feather(). If you want a raw R vector back, you can use write_to_raw(), which wraps that. See https://arrow.apache.org/docs/r/reference/write_to_raw.html for docs; there's a link there to the source if you want to see exactly what it's doing, in case you want to do something slightly differently.

Upvotes: 2

Related Questions