teserver

2019-12-03

teserver是什么

什么是teserver,A simple Docker server for extracting text from pdf, doc, docx, xls, xlsx, csv, pptx, png, jpg, gif, rtf...

teserver使用教程帮助文档

THIS PROJECT IS NOT MAINTAINED

teserver is a Painless Nodejs (Docker and S3 ready) server for extracting text from pdf, doc, docx, xls, xlsx, csv, pptx, png, jpg, gif, rtf...

Getting Started

Install teserver using npm:

npm install teserver

Add these environment variables

S3 storage

AWS_ACCESS_KEY_ID: Amazon Web Service access key
AWS_SECRET_ACCESS_KEY: AWS secret key
S3_BUCKET: AWS bucket name
REGION: Bucket AWS region name
ACL: Access Control List, default public-read

Set the server port and max file size (optional)

MAX_FILE_SIZE: Maximum file size allowed in Mb, default: 20
PORT: Your server port, default: 8080
UPLOAD_DIR: default: 'uploads'

Then, let's build up and start our Docker server

docker build -t teserver .
docker run -it -p 8080:8080 teserver

We can also run it without Docker, but we'll need to to install some dependencies first

sudo apt-get install xpdf
sudo apt-get install antiword
sudo apt-get install unrtf
sudo apt-get install tesseract-ocr

npm start

We are done! just send your http POST request with a file key to

http://machine_ip:8080/upload

You should have this kind of response

{
  "status": "success",
  "file": {
    "fieldname": "file",
    "originalname": "Chomsky, 2003.pdf",
    "encoding": "7bit",
    "mimetype": "application/pdf",
    "size": 92522,
    "bucket": "textanalyseruploads",
    "key": "dc1b37a13512fc6f4asda33fa4a02dfda5b01485720269830.pdf",
    "acl": "public-read",
    "contentType": "application/octet-stream",
    "contentDisposition": null,
    "storageClass": "STANDARD",
    "metadata": {},
    "location": "https://URL_S3/f433fa4a02dfda5b01485720269830.pdf",
    "etag": "\"b8d0a7de12543dde068cc2b5ccd32f68\""
  },
  "text": "The text"
}

If things go wrong, you'll have to deal with this type of response

{
  "status": "error",
  "file": {
    "fieldname": "file",
    "originalname": "Chomsky, 2003.pdf",
    "encoding": "7bit",
    "mimetype": "application/pdf",
    "size": 92522,
    "bucket": "textanalyseruploads",
    "key": "dc1b37a13512fc6f4asda33fa4a02dfda5b01485720269830.pdf",
    "acl": "public-read",
    "contentType": "application/octet-stream",
    "contentDisposition": null,
    "storageClass": "STANDARD",
    "metadata": {},
    "location": "https://URL_S3/f433fa4a02dfda5b01485720269830.pdf",
    "etag": "\"b8d0a7de12543dde068cc2b5ccd32f68\""
  },
  "error": "the error"
}

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


上一篇:textract
下一篇:rentophila
相关文章

首次访问,人机识别验证

扫描下方二维码回复 1024 获取验证码,验证完毕后 永久 无须验证

操作步骤:[打开微信]->[扫描上侧二维码]->[关注 FedJavaScript 的微信] 输入 1024 获取验证码

验证码有误,请重新输入