browser-line-reader
Advanced tools
Comparing version 0.1.2 to 0.2.0
{ | ||
"name": "browser-line-reader", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "A line by line async file reader for the browser", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -57,3 +57,2 @@ # browser-line-reader | ||
- Support for different file encodings | ||
- Support for different kinds of line separators | ||
@@ -60,0 +59,0 @@ - Support for separate read header action |
@@ -5,4 +5,6 @@ // Type definitions for browser-line-reader 0.02 | ||
import { Options } from './interfaces'; | ||
declare class LineReader { | ||
constructor(file: File); | ||
constructor(file: File, options: Options); | ||
@@ -9,0 +11,0 @@ private static readonly chunkSize: number; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var LineReader = (function () { | ||
function LineReader(file) { | ||
function LineReader(file, options) { | ||
var _this = this; | ||
if (options === void 0) { options = { encoding: 'UTF-8' }; } | ||
this.fileReader = new FileReader(); | ||
@@ -12,2 +13,3 @@ this.readPosition = 0; | ||
this.events = new Map(); | ||
this.options = options; | ||
this.fileReader.onerror = function () { return _this.emit('error', _this.fileReader.error.message); }; | ||
@@ -54,3 +56,3 @@ this.fileReader.onload = function () { return _this.onLoad(); }; | ||
this.readPosition += LineReader.chunkSize; | ||
this.fileReader.readAsText(blob); | ||
this.fileReader.readAsText(blob, this.options.encoding); | ||
}; | ||
@@ -57,0 +59,0 @@ LineReader.prototype.step = function () { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12956
12
134
61