From f5fc9ab1d7fa65e3926915eac2df8b8824395d78 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 3 May 2014 10:34:03 +0200 Subject: [PATCH] docs for bytesWritten --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 78da997..d2c7fd8 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ decodes `data`, which can be either a buffer or array of integers, from position if you also require the length (number of bytes) that were required to decode the integer you can access it via `varint.decode.bytesRead`. this is an integer property that will tell you the number of bytes that the last .decode() call had to use to decode. +### varint.encode.bytesWritten + +similar to `bytesRead` when encoding a number it can be useful to know how many bytes where written (especially if you pass an output array). you can access this via `varint.encode.bytesWritten` which holds the number of bytes written in the last encode. + ## usage notes if you are using this to decode buffers from a streaming source it's up to you to make sure that you send 'complete' buffers into `varint.decode`. the maximum number of bytes that varint will need to decode is 8, so all you have to do is make sure you are sending buffers that are at least 8 bytes long from the point at which you know a varint range begins.