17 lines
471 B
JavaScript
17 lines
471 B
JavaScript
|
export const logFrames = [
|
||
|
'hello world\n',
|
||
|
'some more output\ngoes here\n\n--> potentially helpful',
|
||
|
' hopefully, at least.\n',
|
||
|
];
|
||
|
|
||
|
export const logEncode = (frames, index) => {
|
||
|
return frames
|
||
|
.slice(index)
|
||
|
.map(frame => window.btoa(frame))
|
||
|
.map((frame, innerIndex) => {
|
||
|
const offset = frames.slice(innerIndex).reduce((sum, frame) => sum + frame.length, 0);
|
||
|
return JSON.stringify({ Offset: offset, Data: frame });
|
||
|
})
|
||
|
.join('');
|
||
|
};
|