Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 1x 1x 239x 239x 1x 291x 1x 1248x 72x 21x 72x 1x 1248x 72x 21x 72x 39x 39x | import { preArrayOf } from './utils/prepost-array-of' export const bufferFromJson = (obj) => { return Buffer.from(JSON.parse(obj.data).data) } export const bufferToJson = (buf) => ({ __ipfsPostMsgProxyType: 'Buffer', data: JSON.stringify(buf) }) export const isBuffer = Buffer.isBuffer export const isBufferJson = (obj) => obj && obj.__ipfsPostMsgProxyType === 'Buffer' export const preBufferFromJson = (index) => { return (...args) => { if (isBufferJson(args[index])) { args[index] = bufferFromJson(args[index]) } return args } } export const preBufferToJson = (index) => { return (...args) => { if (isBuffer(args[index])) { args[index] = bufferToJson(args[index]) } return args } } export const preArrayOfBufferToJson = (index) => preArrayOf(index, isBuffer, bufferToJson) export const preArrayOfBufferFromJson = (index) => preArrayOf(index, isBufferJson, bufferFromJson) |