(json_obj: any)
| 164 | |
| 165 | // make json object to Blob |
| 166 | export function serialize_json(json_obj: any) { |
| 167 | let json_str = JSON.stringify(json_obj); |
| 168 | const encoder = new TextEncoder(); |
| 169 | const json_buf = encoder.encode(json_str).buffer; |
| 170 | return new Blob([int2bytes(json_buf.byteLength), json_buf], {type: 'application/octet-stream'}); |
| 171 | } |
| 172 | |
| 173 | function int2bytes(num: number) { |
| 174 | const buf = new ArrayBuffer(8); |
no test coverage detected
searching dependent graphs…