File tree 2 files changed +22
-2
lines changed
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 3
3
//
4
4
// The current implementation is based on the V2 format as of July 2nd, 2018.
5
5
//
6
- // See https://github.com/asciinema/asciinema/blob/49a892d9e6f57ab3a774c0835fa563c77cf6a7a7/doc/asciicast-v2.md.
6
+ // From [1], asciicast v2 file is a newline-delimited JSON file where:
7
+ //
8
+ // - first line contains header (initial terminal size, timestamp and other
9
+ // meta-data), encoded as JSON object; and
10
+ // - all following lines form an event stream, each line representing a separate
11
+ // event, encoded as 3-element JSON array.
12
+ //
13
+ // [1]: https://github.com/asciinema/asciinema/blob/49a892d9e6f57ab3a774c0835fa563c77cf6a7a7/doc/asciicast-v2.md.
7
14
package cast
8
15
9
16
import (
17
+ "bufio"
10
18
"encoding/json"
19
+ "io"
11
20
)
12
21
13
22
// Header represents the asciicast header - a JSON-encoded object containing
@@ -96,3 +105,15 @@ type Cast struct {
96
105
// the recording.
97
106
EventStream []* Event
98
107
}
108
+
109
+ // Decode reads the whole contents of the reader passed as argument, validates
110
+ // whether the stream contains a valid asciinema cast and then unmarshals it
111
+ // into a cast struct.
112
+ func Decode (r io.Reader ) (cast * Cast , err error ) {
113
+ return
114
+ }
115
+
116
+ // Encode writes the encoding of `Cast` into the writer passed as an argument.
117
+ func Encode (w io.Writer , cast * Cast ) (err error ) {
118
+ return
119
+ }
Original file line number Diff line number Diff line change 8
8
)
9
9
10
10
var _ = Describe ("Cast" , func () {
11
-
12
11
})
You can’t perform that action at this time.
0 commit comments