Open goretkin opened 4 years ago
Not sure if this helps but if you looking to avoid a physical file:
d = Dict(:hi =>3)
io_ = IOBuffer()
BSON.@save io_ d
bd = take!(io)
EDIT:
io__ = PipeBuffer(take!(io_))
BSON.@load io__ d2
For completeness also see String safe Base64: https://docs.julialang.org/en/v1/stdlib/Base64/#Base64.Base64EncodePipe
Search keywords: BSON with IOBuffer no file
I'm was having trouble going the other way:
BSON.@load io_ d
ERROR: EOFError: read end of file
Stacktrace:
[1] peek at ./iobuffer.jl:180 [inlined]
[2] read at ./iobuffer.jl:190 [inlined]
[3] parse_doc(::Base.GenericIOBuffer{Array{UInt8,1}}) at /home/dehann/.julia/packages/BSON/XAts7/src/read.jl:48
[4] parse at /home/dehann/.julia/packages/BSON/XAts7/src/read.jl:101 [inlined]
[5] load(::Base.GenericIOBuffer{Array{UInt8,1}}) at /home/dehann/.julia/packages/BSON/XAts7/src/read.jl:104
[6] top-level scope at /home/dehann/.julia/packages/BSON/XAts7/src/BSON.jl:52