Skip to content

Commit 11ec070

Browse files
committed
Simplified API and updated README
1 parent b45998b commit 11ec070

File tree

6 files changed

+524
-182
lines changed

6 files changed

+524
-182
lines changed

README.md

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,82 @@
1-
# Character Printer
1+
<img alt="Ninja Print title" src="https://secure.servalldatasystems.com/servall_dev_files/ninja-print/ninja-print.png" height="180px" width="536.5px">
22

3-
Character Printer is a utility for printing human-readable special characters.
3+
### *Finding those ninja characters*
44

5-
Are you ever working with low-level binary or string data that contains special characters (NUL, CR, LF, etc)? Unfortunately `console.log()` has no way to display special characters, making it difficult to determine exactly where they exist in a `String` or `Buffer`. Character Printer makes your life easy by printing out a human readable form of each character.
5+
<img alt="Ninja Print demo" src="https://secure.servalldatasystems.com/servall_dev_files/ninja-print/ninja-print.gif" height="225px" width="400px">
6+
7+
# What is it?
8+
9+
Ninja Print is a utility for printing human-readable special characters.
10+
11+
Are you ever working with binary or string data that contains special characters (NUL, CR, LF, etc)? Unfortunately standard print commands (`echo`, `printf`, `console.log`, etc) will not display special characters, making it difficult to determine exactly where they exist in a `string`. Ninja Print makes your life easy by printing out a human-readable form of each character.
12+
13+
# Installation
14+
15+
`ninprint` requires [NodeJS](https://nodejs.org) and [NPM](https://www.npmjs.com)/[Yarn](https://yarnpkg.com).
616

7-
## Installation
817
#### NPM
918
```bash
10-
npm install character-printer
19+
npm install -g ninprint
1120
```
1221
#### Yarn
1322

1423
```bash
15-
yarn add character-printer
24+
yarn global add ninprint
1625
```
1726

18-
## Examples
19-
```javascript
20-
const { printCharacters } = require("character-printer");
27+
# Examples
2128

22-
printCharacters("Hello world.");
23-
// Output:
24-
// H e l l o [SPACE] w o r l d .
25-
26-
printCharacters("Line feed:\n");
27-
// Output:
28-
// L i n e [SPACE] f e e d : [LF]
29+
You can pipe output from other processes into `ninprint`:
30+
```bash
31+
$ printf "From pipe: \0\r\n" | ninprint
2932

30-
printCharacters("Carriage return:\r");
31-
// Output:
32-
// C a r r i a g e [SPACE] r e t u r n : [CR]
33+
F r o m [SPACE] p i p e : [SPACE] [NUL] [CR] [LF]
34+
```
3335

34-
printCharacters("Null character:\0");
35-
// Output:
36-
// N u l l [SPACE] c h a r a c t e r : [NUL]
36+
Anything sent to `stdin` will be processed:
37+
```bash
38+
$ printf "From file: \b\f\t" > test.bin
39+
$ ninprint < test.bin
3740

38-
printCharacters(new Buffer([0x00, 0x01, 0x02, 0x03, 0x04, 0x05]));
39-
// Output:
40-
// [NUL] [SOH] [STX] [ETX] [EOT] [ENQ]
41+
F r o m [SPACE] f i l e : [SPACE] [BS] [FF] [TAB]
4142
```
4243

43-
## Command Line Interface (CLI)
44-
You can also use the command line interface to print characters from other processes or files using pipe.
44+
# Node Module
45+
You can also use `ninprint` as a Node/Webpack module.
4546

4647
#### NPM
4748
```bash
48-
npm install -g character-printer
49+
npm install ninprint
4950
```
5051
#### Yarn
5152

5253
```bash
53-
yarn global add character-printer
54+
yarn add ninprint
5455
```
5556

56-
Examples:
57+
## Examples
58+
```javascript
59+
const { print: ninprint } = require("ninprint");
5760

58-
```bash
59-
$ printf "From pipe: \0\r\n" | character-printer
61+
ninprint("Hello world.");
62+
// Output:
63+
// H e l l o [SPACE] w o r l d .
6064

61-
F r o m [SPACE] p i p e : [SPACE] [NUL] [CR] [LF]
62-
```
63-
```bash
64-
$ printf "From file: \b\f\t" > test.bin
65-
$ character-printer < test.bin
65+
ninprint("Line feed:\n");
66+
// Output:
67+
// L i n e [SPACE] f e e d : [LF]
6668

67-
F r o m [SPACE] f i l e : [SPACE] [BS] [FF] [TAB]
69+
ninprint("Carriage return:\r");
70+
// Output:
71+
// C a r r i a g e [SPACE] r e t u r n : [CR]
72+
73+
ninprint("Null character:\0");
74+
// Output:
75+
// N u l l [SPACE] c h a r a c t e r : [NUL]
76+
77+
ninprint(new Buffer([0x00, 0x01, 0x02, 0x03, 0x04, 0x05]));
78+
// Output:
79+
// [NUL] [SOH] [STX] [ETX] [EOT] [ENQ]
6880
```
6981

7082
# License

0 commit comments

Comments
 (0)