From 05b30605d7b36499cedaabcaca6be51812f7dd06 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Fri, 9 Jun 2017 18:46:02 +0700 Subject: [PATCH] Add API section to readme --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index b318998..a39f750 100644 --- a/README.md +++ b/README.md @@ -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`
+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