Skip to content

Commit

Permalink
Add API section to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Jun 9, 2017
1 parent 7fdbbd0 commit 05b3060
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions README.md
Expand Up @@ -107,6 +107,51 @@ Benchmark completed with a chunk size of 1 MB
└────────┴──────────────┴──────────────┴──────────────┴──────────────┘
```

## API

### b64(input, [options])

Returns a Promise that resolves to the Base64 encoded/decoded input.

#### input

Type: `string`, `buffer`

A Base64 string to decode, or a Buffer to encode.

#### options

Type: `object`

##### options.chunkSize

Type: `number`<br>
Default: `250000`

Size of the chunk of data to work on before deferring execution to the next iteration of the event loop.

If encoding, the number is interpreted as number of bytes. If decoding, the number is interpreted as number of characters.

### b64.encode(input, [options])

Returns a Promise that resolves to a Base64 encoded string.

#### input

Type: `buffer`

A Buffer to encode.

### b64.decode(input, [options])

Returns a Promise that resolves to a decoded Buffer.

#### input

Type: `string`

A Base64 string to decode.

## License

MIT © Luke Childs

0 comments on commit 05b3060

Please sign in to comment.