Skip to content

Instantly share code, notes, and snippets.

@pandulaDW
Last active August 7, 2021 13:01
Show Gist options
  • Save pandulaDW/acb5e1031c837c25428e846cecf05e07 to your computer and use it in GitHub Desktop.
Save pandulaDW/acb5e1031c837c25428e846cecf05e07 to your computer and use it in GitHub Desktop.
encoding each transaction
// writing the length of the encoded item before writing the data
buf := make([]byte, 4)
binary.LittleEndian.PutUint32(buf, uint32(len(encodedData)))
if _, err := outFile.Write(buf); err != nil {
return err
}
// writing the actual transaction item to the file
if _, err := outFile.Write(encodedData); err != nil {
return err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment