Skip to content

Commit

Permalink
todo: checked the vhs
Browse files Browse the repository at this point in the history
  • Loading branch information
AbsoluteZero000 committed Oct 9, 2024
1 parent fdf65e0 commit bef548f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 2 deletions.
Binary file modified data/output.txt
Binary file not shown.
Binary file added data/output_decode.txt
Binary file not shown.
4 changes: 4 additions & 0 deletions huffman/huffman.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,9 @@ func DeserializeData(data []byte, verbose bool) (string, error) {

content := Decode(root, serializedData, int(bitLength), verbose)

if content == "" {
return "", errors.New("failed to decode data")
}

return content, nil
}
1 change: 0 additions & 1 deletion huffman/huffman_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ func bitStringToBytes(s string) []byte {
result[byteIndex] |= 1 << bitIndex
}
}

return result
}

Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ func main() {
flag.Parse()

data, err := os.ReadFile(*inputFile)

if err != nil {
log.Fatalf("Failed to read file %s: %v", *inputFile, err)
}

var outputData []byte

if *decode {
Expand Down
2 changes: 1 addition & 1 deletion todo.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
✔️ add lipgloss to make it look better
✔️ add a serialization function for the table and the encoded data
- use charmbracelet/vhs to make a cool README file
✔️ use charmbracelet/vhs to make a cool README file

0 comments on commit bef548f

Please sign in to comment.