Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Rowsell committed Mar 29, 2019
1 parent 288b2d2 commit 95f668a
Show file tree
Hide file tree
Showing 5 changed files with 6,563 additions and 41 deletions.
16 changes: 15 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,18 @@ Structure of a file:
Development:
With the command `npm run dev` you can start listening to file changes and run automated tests against all changes made. Tests are in the `test` folder and are named to match the file they are testing, with `.test` infixed between the file name and extension.

All changes are also linted with to Standard JS, and linting and tests must pass to allow commits.
All changes are also linted with to Standard JS, and linting and tests must pass to allow commits.

List filesizes:
`ls -lhSr`

Ty it out, create a copy:
`cp readme.md copied-readme`
Compress the copy:
`node index.js copied-readme`
Remove the uncompressed copy:
`rm copied-readme`
Decompress the compressed file:
`node index.js copied-readme.jzip`
Compare the outputs:
`diff <(cat copied-readme) <(cat readme.md)`
31 changes: 1 addition & 30 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,6 @@

const { readFromFile } = require('./lib/readfile')
const fileTarget = process.argv[2]
const mode = /jzip/i.test(fileTarget) ? 'decompress' : 'compress'
const mode = /\.jzip$/i.test(fileTarget) ? 'decompress' : 'compress'

readFromFile(fileTarget, mode)

// console.log('Compressed text matches')
// console.log(compressed === compressedText)
// console.log('Compressed Text before & after length match: ')
// console.log(compressed.length === compressedText.length)
// console.log('Trees are the same: ')
// console.log(JSON.stringify(tree) === JSON.stringify(newTree))
// console.log('Decompressed are the same')
// console.log(decompressed.length === encoded.length)
// console.log('Decoded and encoded match')
// console.log(decoded.length)

// console.log(decoded === STR)
// console.log('Original text: ')
// console.log(STR)
// console.log('Encoded without tree (Currently string 1|0 but represents bits): ')
// console.log(encoded)
// console.log('Original characters length: ')
// console.log(STR.length)
// console.log('Input bits length at 8/16/32 bit encodings')
// console.log(8 * STR.length + '/' + 16 * STR.length + '/' + 32 * STR.length)
// console.log('Encoded Bits length: ')
// console.log(encoded.length)
// console.log('Encoded and Compressed Tree + Text Bits length: ')
// console.log(compressed.length * 32)
// console.log('Encoded and compressed Tree + Text: ')
// console.log(compressed)
// console.log('Decompressed and Decoded text: ')
// console.log(decoded)
2 changes: 1 addition & 1 deletion lib/encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const getCharacterFrequencies = (str) => {
frequencies[char] = frequencies[char] ? frequencies[char] : 0
frequencies[char]++
}
console.log('potential area of failure')
// console.log('potential area of failure')
// let characters = characterString.split('')

for (const symbol of str) {
Expand Down
Loading

0 comments on commit 95f668a

Please sign in to comment.