2017-11-16 02:12:16 +00:00
|
|
|
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
|
2017-11-17 00:31:18 +00:00
|
|
|
.slice(0, index + 1)
|
2017-11-16 02:12:16 +00:00
|
|
|
.map(frame => window.btoa(frame))
|
|
|
|
.map((frame, innerIndex) => {
|
2017-11-17 00:31:18 +00:00
|
|
|
const offset = frames.slice(0, innerIndex).reduce((sum, frame) => sum + frame.length, 0);
|
2017-11-16 02:12:16 +00:00
|
|
|
return JSON.stringify({ Offset: offset, Data: frame });
|
|
|
|
})
|
|
|
|
.join('');
|
|
|
|
};
|