If true, numeric and boolean data will be converted to their type instead of remaining strings.
If true, numeric and boolean data will be converted to their type instead of remaining strings. Numeric data must conform to the definition of a decimal literal. (European-formatted numbers must have commas and dots swapped.)
</td>
</td>
</tr>
</tr>
<tr>
<tr>
@ -429,11 +429,11 @@ var csv = Papa.unparse({
</td>
</td>
<td>
<td>
To <ahref="/faq#streaming">stream</a> the input, define a callback function:
To <ahref="/faq#streaming">stream</a> the input, define a callback function:
Streaming is necessary for large files which would otherwise crash the browser. Except when using a <ahref="/faq#worker">Web Worker</a>, you can call <code>handle.abort()</code> to stop parsing,<code>handle.pause()</code> to pause it, or<code>handle.resume()</code> to resume.
Streaming is necessary for large files which would otherwise crash the browser. You can call <code>parser.abort()</code> to abort parsing. And, except when using a <ahref="/faq#worker">Web Worker</a>, you can call<code>parser.pause()</code> to pause it, and<code>parser.resume()</code> to resume.
</td>
</td>
</tr>
</tr>
<tr>
<tr>
@ -486,7 +486,7 @@ var csv = Papa.unparse({
<code>fastMode</code>
<code>fastMode</code>
</td>
</td>
<td>
<td>
When enabled, fast mode executes parsing much more quickly. However, this only works for input without quoted fields. If you cannot guarantee that, do not enable fast mode.
Fast mode speeds up parsing significantly for large inputs. However, it only works when the input has no quoted fields. Fast mode will automatically be enabled if no <code>"</code> characters appear in the input. You can force fast mode either way by setting it to <code>true</code> or <code>false</code>.
</td>
</td>
</tr>
</tr>
</table>
</table>
@ -693,7 +693,7 @@ var csv = Papa.unparse({
<tr>
<tr>
<td><code>Papa.SCRIPT_PATH</code></td>
<td><code>Papa.SCRIPT_PATH</code></td>
<td>
<td>
The relative path to Papa Parse. This is automatically detected when Papa Parse is loaded synchronously. However, if you load Papa Parse asynchronously (e.g. with RequireJS), you need to set this variable manually in order to use Web Workers. (In those cases, this variable is <i>not</i> read-only.)
The relative path to Papa Parse. This is automatically detected when Papa Parse is loaded synchronously. However, if you load Papa Parse asynchronously (e.g. with RequireJS), you need to set this variable manually in order to use Web Workers. (In those cases, this variable is <i>not</i> read-only and you should set it!)
</td>
</td>
</tr>
</tr>
</table>
</table>
@ -726,48 +726,12 @@ var csv = Papa.unparse({
<tr>
<tr>
<td><code>Papa.DefaultDelimiter</code></td>
<td><code>Papa.DefaultDelimiter</code></td>
<td>
<td>
The delimiter used when one is not specified and it cannot be detected automatically. Default is comma.
The delimiter used when it is left unspecified and cannot be detected automatically. Default is comma.
</td>
</td>
</tr>
</tr>
</table>
</table>
</div>
</div>
<divclass="grid-100">
<h5id="internal">For Internal Use Only</h5>
</div>
<divclass="grid-100">
<table>
<tr>
<th>Internal Property</th>
<th>Explanation</th>
</tr>
<tr>
<td><code>Papa.Parser</code></td>
<td>
The core parsing component. Careful, it's fast and under rigorous test.
</td>
</tr>
<tr>
<td><code>Papa.ParserHandle</code></td>
<td>
A wrapper over the Parser which provides dynamic typing and header row support.
</td>
</tr>
<tr>
<td><code>Papa.NetworkStreamer</code></td>
<td>
Facilitates downloading and parsing files in chunks over the network with XMLHttpRequest.
</td>
</tr>
<tr>
<td><code>Papa.FileStreamer</code></td>
<td>
Similar to NetworkStreamer, but for local files, and using the HTML5 FileReader.
<h6id="open-source">Is it open source? (Can I contribute something?)</h6>
<h6id="open-source">Is it open source? (Can I contribute something?)</h6>
<p>
<p>
Yes, please! I don't want to do this all by myself. Head over to the <ahref="https://github.com/mholt/PapaParse">GitHub project page</a> and hack away. If you're making a significant change, open an issue first so we can talk about it.
Yes, please! I don't want to do this all by myself. Head over to the <ahref="https://github.com/mholt/PapaParse">GitHub project page</a> and hack away. If you're making a significant change, open an issue first so we can talk about it.
@ -108,9 +107,9 @@
<h6id="fast-mode">Why wouldn't I always enable fast mode?</h6>
<h6id="fast-mode">What's the deal with fast mode?</h6>
<p>
<p>
Fast mode makes <ahref="http://jsperf.com/javascript-csv-parsers/3">Papa Parse screaming fast</a>, but you wouldn't want to use it if there are (or may be) quoted fields in your input. Fast mode is fast because it makes one major assumption: no quoted fields. But if you know that your input has no quotes, turn that sucker on. With fast mode on, 1 GB files can be parsed in about 20 seconds.
Fast mode makes <ahref="http://jsperf.com/javascript-csv-parsers/3">Papa Parse screaming fast</a>, but you wouldn't want to use it if there are quoted fields in your input. Fast mode is fast because it makes one major assumption: no quoted fields. If you don't specify fastMode either way, fast mode will be turned on automatically if there are no quote characters in the input. With fast mode on, 1 GB files can be parsed in about 20 seconds.
</p>
</p>
@ -126,7 +125,7 @@
<h6>Can Papa load and parse huge files?</h6>
<h6>Can Papa load and parse huge files?</h6>
<p>
<p>
Yes. Parsing huge text files is facilitated by <i>streaming</i>, where the file is loaded a little bit at a time, parsed, and the results are sent to your <ahref="/docs#config">step</a> callback function, row-by-row.
Yes. Parsing huge text files is facilitated by <i>streaming</i>, where the file is loaded a little bit at a time, parsed, and the results are sent to your <ahref="/docs#config">step</a> callback function, row-by-row. You can also get results chunk-by-chunk (which is usually faster) by using the <code>chunk</code> callback function in the same way.
</p>
</p>
<h6>How do I stream my input?</h6>
<h6>How do I stream my input?</h6>
@ -134,6 +133,11 @@
Just specify a <ahref="/docs#config">step</a> callback function. Results will <i>not</i> be available after parsing is finished, however. You have to inspect the results one row at a time.
Just specify a <ahref="/docs#config">step</a> callback function. Results will <i>not</i> be available after parsing is finished, however. You have to inspect the results one row at a time.
</p>
</p>
<h6>What if I want more than 1 row at a time?</h6>
<p>
Use the <code>chunk</code> callback instead. It works just like step, but you get an entire chunk of the file at a time, rather than a single row. Don't try to use step and chunk together (the behavior is undefined).
</p>
<h6>What is a stream and when should I stream files?</h6>
<h6>What is a stream and when should I stream files?</h6>
<p>
<p>
A stream is a unique data structure which, given infinite time, gives you infinite space.
A stream is a unique data structure which, given infinite time, gives you infinite space.
@ -172,7 +176,7 @@
<h6>Can I pause and resume parsing?</h6>
<h6>Can I pause and resume parsing?</h6>
<p>
<p>
Yes, as long as you are streaming and not using a worker. Your <ahref="/docs#step">step callback</a>is passed a ParserHandle which has pause, resume, and abort functions.
Yes, as long as you are streaming and not using a worker. Your <ahref="/docs#step">step callback</a>(same with the <code>chunk</code> callback) is passed a parser which has pause, resume, and abort functions. This is exceptionally useful when performing asynchronous actions during parsing, for example, AJAX requests. You can always abort parsing in your callback, even when using workers, but pause and resume is only available without a worker.
</p>
</p>
@ -217,6 +221,11 @@
<p>
<p>
Yup. If the input is too large to fit in memory (or large enough to crash the browser), streaming is <i>always</i> the answer, even in a worker thread. Workers keep the page reactive. Streaming makes it able to fit in memory. Use both if you need to.
Yup. If the input is too large to fit in memory (or large enough to crash the browser), streaming is <i>always</i> the answer, even in a worker thread. Workers keep the page reactive. Streaming makes it able to fit in memory. Use both if you need to.
</p>
</p>
<h6>Can I pause/resume workers?</h6>
<p>
No. This would drastically slow down parsing, as it would require the worker to wait after every chunk for a "continue" signal from the main thread. But you <i>can</i> abort workers by calling <code>.abort()</code> on the parser that gets passed to your callback function.