Coder Social home page Coder Social logo

ftpwatch's Introduction

descprition

用于在FTP服务器上监听固定路径下的文件变化,目前是针对扫描仪上传图片到FTP后对图片进行处理,并整合数据传到项目中使用。

use

1.将该项目放在某文件夹
2.执行 npm install 安装编译依赖模块(需要用到imagemagick)
3.修改 data.json 文件对应的配置
4.执行 npm start 启动项目
5.访问localhost:8999 即可访问

data.json

ftp : 监听的总路径 target 移动后的路径 api : 成功后的调用接口 delay : 延迟调用 dpi : 图片压缩的dpi值 thumbWidth : 缩略图的宽度 compressWidth : 原图的压缩宽度 compressQuality : 原图的压缩质量

thinking

  1. 根据监听文件变化,获得文件的路径
  2. 创建一个随机名称对应该路径
  3. 对图片进行分割,分成四份,获得四个角
  4. 针对每个角进行扫描获得是否存在有二维码
  5. 目前固定的位置是:右上角、右下角,然后根据二维码内容确定图片的旋转方式
  6. 将原图压缩后放在目标位置
  7. 然后将原图创建一个缩略图放在目标位置
  8. 获得文件的:创建时间、二维码内容、路径,然后通过调用接口调用传递到项目中
  9. 最后调用成功后,删除源文件
  10. 由于可能存在大量文件的创建导致多次调用API过于频繁,增加延迟,在时间阶段内发现的固定目录下的文件,统一处理调用。

2

1.监听到大量的文件变化 2.将变化的数据添加到数组中 3.获取到一个未转化的对象,放到run数组中,最大数量不能超过max 4.拿到一个未转化的对象,然后开始对图片进行分割、灰度、二值化、缩放等处理,读取二维码 5.获取到结果后,将数据提交到API中,然后重置队列,重新进行图片处理 6.结束后继续循环。

ftpwatch's People

Contributors

chrunlee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.