Closed kinnalru closed 11 months ago
It's a bit of a hack, but you can do this:
require 'msgpack'
already_packed = {test: 123}.to_msgpack
pk = MessagePack::Packer.new
pk.write_map_header(1).write('already')
pk.buffer << already_packed
p MessagePack.load(pk.to_s) # => {"already"=>{"test"=>123}}
But other than that, Packer
doesn't expose a way to append a fragment, perhaps it should.
To clarify, write_bin
, is fro writing a "binary string" as in the "binary string" type in the messagepack format.
Hello. Cannot find how to write msgpacked data to
MessagePack::Packer
:already_packed
used for cached static chunks of data