Commit e3d5e476 authored by jgould's avatar jgould

fallback if byte range requests are not supported

parent 3851059f
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -7,6 +7,16 @@ morpheus.GctReader.prototype = { ...@@ -7,6 +7,16 @@ morpheus.GctReader.prototype = {
return 'gct'; return 'gct';
}, },
read: function (fileOrUrl, callback) { read: function (fileOrUrl, callback) {
if (fileOrUrl instanceof File) {
this._readChunking(fileOrUrl, callback, false);
} else {
this._readChunking(fileOrUrl, callback, true);
}
},
_readChunking: function (fileOrUrl, callback, tryNoChunkIfError) {
var _this = this;
// Papa.LocalChunkSize = 10485760 * 10; // 100 MB
// Papa.RemoteChunkSize = 10485760 * 10; // 100 MB
var lineNumber = 0; var lineNumber = 0;
var version; var version;
var numRowAnnotations = 1; // in addition to row id var numRowAnnotations = 1; // in addition to row id
...@@ -155,7 +165,11 @@ morpheus.GctReader.prototype = { ...@@ -155,7 +165,11 @@ morpheus.GctReader.prototype = {
callback(null, dataset); callback(null, dataset);
}, },
error: function (err) { error: function (err) {
callback(err); if (tryNoChunkIfError) {
_this._readNoChunking(fileOrUrl, callback);
} else {
callback(err);
}
}, },
download: !(fileOrUrl instanceof File), download: !(fileOrUrl instanceof File),
skipEmptyLines: false, skipEmptyLines: false,
...@@ -418,7 +432,7 @@ morpheus.GctReader.prototype = { ...@@ -418,7 +432,7 @@ morpheus.GctReader.prototype = {
} }
}, },
_read: function (fileOrUrl, callback) { _readNoChunking: function (fileOrUrl, callback) {
var _this = this; var _this = this;
var name = morpheus.Util.getBaseFileName(morpheus.Util var name = morpheus.Util.getBaseFileName(morpheus.Util
.getFileName(fileOrUrl)); .getFileName(fileOrUrl));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment