PapaParseJavaScript 的 CSV 解析库
Papa Parse 是一个在浏览器上实现对 CSV 数据的解析库,速度非常快,主要特性:
- 易用
 - 支持直接解析 CSV 文件,包括本地和网络
 - 快速模式 (真的非常快)
 - 对超大文件进行流处理 (甚至是 HTTP)
 - 分享解析,也就是将 JSON 转成 CSV
 - 自动检测分隔符
 - 使用工作线程确保网页仍能响应用户的操作
 - 支持表格头
 - 支持暂停、恢复和中断
 - 可转换数字和布尔值到其他类型
 - 可选的 jQuery 集成,以获取 
<input type="file">元素指定的文件 - 目前唯一支持换行和引号的解析器
 
Papa Parse 没有任何依赖,甚至是 jQuery
示例代码:
$('input[type=file]').parse({
	config: {
		// base config to use for each file
	},
	before: function(file, inputElem)
	{
		// executed before parsing each file begins;
		// what you return here controls the flow
	},
	error: function(err, file, inputElem, reason)
	{
		// executed if an error occurs while loading the file,
		// or if before callback aborted for some reason
	},
	complete: function()
	{
		// executed after all files are complete
	}
}); 
评论
