You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tl;dr: seems like there's no public api in transit-cljs to de/serialize to and from JS objects. If that's the case, could one be added?
Hi there,
my use case for transit is to store cljs data structures in IndexedDB.
IndexedDB can store any serializable object as a value (see spec).
I looked into the on-disk size of storing transit values as a string (that is, a value produced by calling transit-cljs's write) vs a "js object" representation (that is, what's produced by calling JSON.parse onto the previous string value).
It looks like the js object representation is about 20% more efficient in terms of disk size than the string representation for my workload.
That said, there doesn't seem to be a public api to produce the "js object" representation from transit-cljs. Is that so? If yes, could one be added?
In terms of API, it could be one more reader/write type, perhaps :js-object and :js-object-verbose.
Thanks!
P.S. Here's an attempt of hacking this together:
The writer seems straightforward enough: (.write writer in #js {"marshalTop" false}).
While for the reader we have to hook into more internal components
tl;dr: seems like there's no public api in transit-cljs to de/serialize to and from JS objects. If that's the case, could one be added?
Hi there,
my use case for transit is to store cljs data structures in IndexedDB.
IndexedDB can store any serializable object as a value (see spec).
I looked into the on-disk size of storing transit values as a string (that is, a value produced by calling transit-cljs's write) vs a "js object" representation (that is, what's produced by calling JSON.parse onto the previous string value).
It looks like the js object representation is about 20% more efficient in terms of disk size than the string representation for my workload.
That said, there doesn't seem to be a public api to produce the "js object" representation from transit-cljs. Is that so? If yes, could one be added?
In terms of API, it could be one more reader/write type, perhaps
:js-object
and:js-object-verbose
.Thanks!
P.S. Here's an attempt of hacking this together:
The writer seems straightforward enough:
(.write writer in #js {"marshalTop" false})
.While for the reader we have to hook into more internal components
The text was updated successfully, but these errors were encountered: