diff --git a/README.md b/README.md
index 73d1262..065d2bc 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ Tesseract.js works with a `
+
```
After including your scripts, the `Tesseract` variable should be defined! You can [head to the docs](#docs) for a full treatment of the API.
diff --git a/dist/tesseract.js b/dist/tesseract.js
index 373de20..af905e8 100644
--- a/dist/tesseract.js
+++ b/dist/tesseract.js
@@ -268,14 +268,14 @@ process.umask = function() { return 0; };
},{}],3:[function(require,module,exports){
module.exports={
"name": "tesseract.js",
- "version": "1.0.5",
+ "version": "1.0.6",
"description": "Pure Javascript Multilingual OCR",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" & exit 1",
"start": "watchify src/index.js -t [ envify --NODE_ENV development ] -t [ babelify --presets [ es2015 ] ] -o dist/tesseract.dev.js --standalone Tesseract & watchify src/browser/worker.js -t [ envify --NODE_ENV development ] -t [ babelify --presets [ es2015 ] ] -o dist/worker.dev.js & http-server -p 7355",
"build": "browserify src/index.js -t [ babelify --presets [ es2015 ] ] -o dist/tesseract.js --standalone Tesseract && browserify src/browser/worker.js -t [ babelify --presets [ es2015 ] ] -o dist/worker.js",
- "release": "git tag `jq -r '.version' package.json`"
+ "release": "git tag `jq -r '.version' package.json` && git push origin --tags && npm publish"
},
"browser": {
"./src/node/index.js": "./src/browser/index.js"
@@ -321,7 +321,7 @@ var defaultOptions = {
if (process.env.NODE_ENV === "development") {
console.debug('Using Development Configuration');
- defaultOptions.workerPath = location.protocol + '//' + location.host + '/dist/worker.dev.js';
+ defaultOptions.workerPath = location.protocol + '//' + location.host + '/dist/worker.dev.js?nocache=' + Math.random().toString(36).slice(3);
} else {
var version = require('../../package.json').version;
defaultOptions.workerPath = 'https://cdn.rawgit.com/naptha/tesseract.js/' + version + '/dist/worker.js';
diff --git a/dist/worker.js b/dist/worker.js
index cc0a85c..7a93d77 100644
--- a/dist/worker.js
+++ b/dist/worker.js
@@ -11857,7 +11857,14 @@ function hasOwnProperty(obj, prop) {
'use strict';
var leveljs = require('level-js');
-var db = typeof indexedDB === 'undefined' ? { open: function open(_, cb) {
+
+// something about trying to store these language files in indexedDB
+// causes iOS Safari to crash
+
+var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
+var noIDB = typeof indexedDB === 'undefined' || iOS;
+
+var db = noIDB ? { open: function open(_, cb) {
return cb(true);
} } : leveljs('./tessdata2');
@@ -11867,10 +11874,13 @@ module.exports = function getLanguageData(req, res, cb) {
var lang = req.options.lang;
function saveDataFile(data) {
- db.put(lang, data, function (err) {
- return console.log('cached', lang, err);
- });
- cb(data);
+ try {
+ db.put(lang, data, function (err) {
+ return console.log('cached', lang, err);
+ });
+ } finally {
+ cb(data);
+ }
}
db.open({ compression: false }, function (err) {
@@ -11907,17 +11917,20 @@ function fetchLanguageData(req, res, cb) {
xhr.onload = function (e) {
if (!(xhr.status == 200 || xhr.status == 0 && xhr.response)) return res.reject('Error downloading language ' + url);
- res.progress({ status: 'unzipping ' + langfile });
+ res.progress({ status: 'unzipping ' + langfile, progress: 0 });
// in case the gzips are already ungzipped or extra gzipped
var response = new Uint8Array(xhr.response);
try {
+ var n = 2;
while (response[0] == 0x1f && response[1] == 0x8b) {
response = ungzip(response);
+ res.progress({ status: 'unzipping ' + langfile, progress: 1 - 1 / n++ });
}
} catch (err) {
return res.reject('Error unzipping language file ' + langfile + '\n' + err.message);
}
+ res.progress({ status: 'unzipping ' + langfile, progress: 1 });
cb(response);
};
@@ -12245,9 +12258,10 @@ function loadLanguage(req, res, cb) {
if (lang in Module._loadedLanguages) return cb();
adapter.getLanguageData(req, res, function (data) {
+ res.progress({ status: 'loading ' + lang + '.traineddata', progress: 0 });
Module.FS_createDataFile('tessdata', lang + ".traineddata", data, true, false);
- res.progress({ status: 'loading ' + lang + '.traineddata', progress: 1 });
Module._loadedLanguages[lang] = true;
+ res.progress({ status: 'loading ' + lang + '.traineddata', progress: 1 });
cb();
});
}
diff --git a/package.json b/package.json
index 6788062..ad97aaa 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "tesseract.js",
- "version": "1.0.5",
+ "version": "1.0.6",
"description": "Pure Javascript Multilingual OCR",
"main": "src/index.js",
"scripts": {