Browse Source

fixed the doc of the decoder.

decoder may get also string, not just buffer - so rename it to chunk.
pull/650/head
Ran Grizm 6 years ago
parent
commit
4e1de42673
  1. 8
      docs/docs.html

8
docs/docs.html

@ -536,11 +536,11 @@ var csv = Papa.unparse({
<code>decoder</code> <code>decoder</code>
</td> </td>
<td> <td>
A function which allows custom decoding for the buffer string. A function which allows custom decoding of the chunk.
The function get Buffer and Encoding, and returns a string. The function get Chunk (Buffer/string) and Encoding, and returns a string.
i.e assuming const iconv = require('iconv-lite'): i.e assuming const iconv = require('iconv-lite'):
(buf , encoding) => { (chunk , encoding) => {
if (iconv.encodingExists(encoding)) { return iconv.decode(buf, encoding) }; if (iconv.encodingExists(encoding)) { return iconv.decode(chunk, encoding) };
throw new TypeError('[ERR_UNKNOWN_ENCODING]', 'Unknown encoding: ' + encoding) throw new TypeError('[ERR_UNKNOWN_ENCODING]', 'Unknown encoding: ' + encoding)
} }
</td> </td>

Loading…
Cancel
Save