From 244a948991138a6988f2cd17ef28cb8ef64e0da2 Mon Sep 17 00:00:00 2001 From: Jerome Wu Date: Thu, 15 Nov 2018 10:09:05 +0800 Subject: [PATCH] Use jsDelivr as cdn --- README.md | 8 ++++---- src/browser/index.js | 8 ++++---- src/node/index.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 223e06d..bf522b7 100644 --- a/README.md +++ b/README.md @@ -251,19 +251,19 @@ Because of this we recommend loading `tesseract.js` from a CDN. But if you reall ```javascript window.Tesseract = Tesseract.create({ workerPath: '/path/to/worker.js', - langPath: 'https://rawcdn.githack.com/naptha/tessdata/gh-pages/3.02/', - corePath: 'https://rawcdn.githack.com/naptha/tesseract.js-core/0.1.0/index.js', + langPath: 'https://cdn.jsdelivr.net/gh/naptha/tessdata@gh-pages/3.02/', + corePath: 'https://cdn.jsdelivr.net/gh/naptha/tesseract.js-core@0.1.0/index.js', }) ``` ### corePath -A string specifying the location of the [tesseract.js-core library](https://github.com/naptha/tesseract.js-core), with default value 'https://rawcdn.githack.com/naptha/tesseract.js-core/master/index.js'. Set this string before calling `Tesseract.recognize` and `Tesseract.detect` if you want Tesseract.js to use a different file. +A string specifying the location of the [tesseract.js-core library](https://github.com/naptha/tesseract.js-core), with default value 'https://cdn.jsdelivr.net/gh/naptha/tesseract.js-core@0.1.0/index.js'. Set this string before calling `Tesseract.recognize` and `Tesseract.detect` if you want Tesseract.js to use a different file. ### workerPath A string specifying the location of the [worker.js](./dist/worker.js) file. Set this string before calling `Tesseract.recognize` and `Tesseract.detect` if you want Tesseract.js to use a different file. ### langPath -A string specifying the location of the tesseract language files, with default value 'https://rawcdn.githack.com/naptha/tessdata/gh-pages/3.02/'. Language file URLs are calculated according to the formula `langPath + langCode + '.traineddata.gz'`. Set this string before calling `Tesseract.recognize` and `Tesseract.detect` if you want Tesseract.js to use different language files. +A string specifying the location of the tesseract language files, with default value 'https://cdn.jsdelivr.net/gh/naptha/tessdata@gh-pages/3.02/'. Language file URLs are calculated according to the formula `langPath + langCode + '.traineddata.gz'`. Set this string before calling `Tesseract.recognize` and `Tesseract.detect` if you want Tesseract.js to use different language files. ## Contributing diff --git a/src/browser/index.js b/src/browser/index.js index 9dc256d..f17f378 100644 --- a/src/browser/index.js +++ b/src/browser/index.js @@ -1,7 +1,7 @@ var defaultOptions = { - // workerPath: 'https://rawcdn.githack.com/naptha/tesseract.js/0.2.0/dist/worker.js', - corePath: 'https://rawcdn.githack.com/naptha/tesseract.js-core/0.1.0/index.js', - langPath: 'https://rawcdn.githack.com/naptha/tessdata/gh-pages/3.02/', + // workerPath: 'https://cdn.jsdelivr.net/gh/naptha/tesseract.js@0.2.0/dist/worker.js', + corePath: 'https://cdn.jsdelivr.net/gh/naptha/tesseract.js-core@0.1.0/index.js', + langPath: 'https://cdn.jsdelivr.net/gh/naptha/tessdata@gh-pages/3.02/', } if (process.env.NODE_ENV === "development") { @@ -9,7 +9,7 @@ if (process.env.NODE_ENV === "development") { 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://rawcdn.githack.com/naptha/tesseract.js/' + version + '/dist/worker.js' + defaultOptions.workerPath = 'https://cdn.jsdelivr.net/gh/naptha/tesseract.js@' + version + '/dist/worker.js' } exports.defaultOptions = defaultOptions; diff --git a/src/node/index.js b/src/node/index.js index 50881cc..d0177dc 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -5,7 +5,7 @@ const fetch = require('isomorphic-fetch'), exports.defaultOptions = { workerPath: require('path').join(__dirname, 'worker.js'), - langPath: 'http://rawcdn.githack.com/naptha/tessdata/gh-pages/3.02/', + langPath: 'https://cdn.jsdelivr.net/gh/naptha/tessdata@gh-pages/3.02/', } exports.spawnWorker = function spawnWorker(instance, workerOptions){