Papa Parse 是一个在浏览器上实现对 CSV 数据的解析库,速度非常快,主要特性:
<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 } });