github.com/manicqin/nomad@v0.9.5/ui/mirage/data/logs.js (about)

     1  export const logFrames = [
     2    'hello world\n',
     3    'some more output\ngoes here\n\n--> potentially helpful',
     4    ' hopefully, at least.\n',
     5  ];
     6  
     7  export const logEncode = (frames, index) => {
     8    return frames
     9      .slice(0, index + 1)
    10      .map(frame => window.btoa(frame))
    11      .map((frame, innerIndex) => {
    12        const offset = frames.slice(0, innerIndex).reduce((sum, frame) => sum + frame.length, 0);
    13        return JSON.stringify({ Offset: offset, Data: frame });
    14      })
    15      .join('');
    16  };