-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
930665c
commit 5148809
Showing
11 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node.exe file_decoder.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const fs = require('fs'); | ||
const base64 = require('base64-js'); | ||
const readline = require('readline').createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}); | ||
|
||
console.log('Enter the input file (with the file path):'); | ||
readline.question('', (InputFile) => { | ||
console.log('Enter the output folder (with a filename and extanmtion):'); | ||
readline.question('', (OutputFolder) => { | ||
incode(InputFile, OutputFolder); | ||
readline.close(); | ||
}); | ||
}); | ||
|
||
const incode = (InputFile, OutputFolder) => { | ||
|
||
fs.readFile(InputFile, 'utf8', (err, data) => { | ||
if (err) throw err; | ||
|
||
const padding = '='.repeat((4 - data.length % 4) % 4); | ||
const paddedBase64String = data + padding; | ||
|
||
const bytes = base64.toByteArray(paddedBase64String); | ||
const decodedString = new TextDecoder().decode(bytes); | ||
|
||
fs.writeFile(OutputFolder, decodedString, (err) => { | ||
if (err) throw err; | ||
console.log(`Decoded string written to ${OutputFolder}`); | ||
console.log(`this is the Decoded string: ${decodedString}`); | ||
}); | ||
}); | ||
setTimeout(() => { | ||
process.exit() | ||
}, 10000) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node.exe file_incoder.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const fs = require('fs'); | ||
const base64 = require('base64-js'); | ||
const readline = require('readline').createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}); | ||
|
||
console.log('Enter the input file (with the file path):'); | ||
readline.question('', (InputFile) => { | ||
console.log('Enter the output folder (with a filename and extanmtion):'); | ||
readline.question('', (OutputFolder) => { | ||
incode(InputFile, OutputFolder); | ||
readline.close(); | ||
}); | ||
}); | ||
|
||
const incode = (InputFile, OutputFolder) => { | ||
|
||
fs.readFile(InputFile, 'utf8', (err, data) => { | ||
if (err) throw err; | ||
|
||
const bytes = new TextEncoder().encode(data); | ||
const base64String = base64.fromByteArray(bytes); | ||
|
||
fs.writeFile(OutputFolder, `${base64String} \n file path and name: ${__filename}`, (err) => { | ||
if (err) throw err; | ||
console.log(`Encoded string written to ${OutputFolder}`); | ||
console.log(`this is the incoded text: ${base64String}`) | ||
}); | ||
}); | ||
setTimeout(() => { | ||
process.exit() | ||
}, 10000) | ||
} |
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"dependencies": { | ||
"base64-js": "^1.5.1", | ||
"fs": "^0.0.1-security", | ||
"readline": "^1.3.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node.exe text_decoder.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const fs = require('fs'); | ||
const base64 = require('base64-js'); | ||
const readline = require('readline').createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}); | ||
|
||
console.log('Enter the input text:'); | ||
readline.question('', (InputText) => { | ||
console.log('Enter the output folder (with a filename and extanmtion):'); | ||
readline.question('', (OutputFolder) => { | ||
incode(InputText, OutputFolder); | ||
readline.close(); | ||
}); | ||
}); | ||
|
||
|
||
const incode = (InputText, OutputFolder) => { | ||
|
||
const padding = '='.repeat((4 - InputText.length % 4) % 4); | ||
const paddedBase64String = InputText + padding; | ||
|
||
const bytes = base64.toByteArray(paddedBase64String); | ||
const decodedString = new TextDecoder().decode(bytes); | ||
|
||
fs.writeFile(OutputFolder, decodedString, (err) => { | ||
if (err) throw err; | ||
console.log(`Decoded string written to ${OutputFolder}`); | ||
console.log(`this is the decoded text: ${decodedString}`) | ||
}); | ||
setTimeout(() => { | ||
process.exit() | ||
}, 10000) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node.exe text_incoder.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const fs = require('fs'); | ||
const base64 = require('base64-js'); | ||
const readline = require('readline').createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}); | ||
|
||
console.log('Enter the input text:'); | ||
readline.question('', (InputText) => { | ||
console.log('Enter the output folder (with a filename and extanmtion):'); | ||
readline.question('', (OutputFolder) => { | ||
incode(InputText, OutputFolder); | ||
readline.close(); | ||
}); | ||
}); | ||
|
||
const incode = (InputText, OutputFolder) => { | ||
|
||
const bytes = new TextEncoder().encode(InputText); | ||
const base64String = base64.fromByteArray(bytes); | ||
|
||
fs.writeFile(OutputFolder, base64String, (err) => { | ||
if (err) throw err; | ||
console.log(`Encoded string written to ${OutputFolder}`); | ||
console.log(`this is the incoded text: ${base64String}`) | ||
}); | ||
setTimeout(() => { | ||
process.exit() | ||
}, 10000) | ||
} |