GithubHelp home page GithubHelp logo

ryansn / doxie-node Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 3.0 1.73 MB

Node.js API library for getting scans off your Doxie go, Doxie Q, and Doxie go SE scanners ❤️

Home Page: https://ryansn.github.io/doxie-node

License: MIT License

JavaScript 99.65% Shell 0.35%
nodejs doxie-go doxie-scanner doxie-api javascript doxie-q doxie-go-se doxie sdk doxie-wifi hacktoberfest2021 hacktoberfest

doxie-node's Introduction

doxie-node

CI GitHub license npm Coverage Status

Node.js library for Doxie go Wi-fi, Doxie Q, and Doxie Go SE

This is a Node js wrapper library/SDK for the API provided from the Doxie series of Wi-Fi document scanners.

Documentation

See Doxie's offical API documentation

installation

yarn add doxie-node

or

npm install doxie-node --save

Usage / Initialize

This requires knowing your Doxie's IP address on your network. All methods return a promise.

import doxieNode from 'doxie-node';
const doxie = new doxieNode({ doxieURL: 'http://192.168.1.3' });

Available options

doxie-node can take the following options:

  • username optional - defaults:doxie
  • password optional
  • token optional - base64 encoded username and password token (ie. Basic [token]) if username and password provided, this token is created for you.
  • doxieURL required
  • doxiePort optional - default:8080

Methods

hello

Used to check the status of your Doxie. If calling on a Doxie go SE or Doxie Q the return will include the firmware and connectedToExternalPower.

return doxie.hello().then(response);

returns

{
  model: 'DX250',
  name: 'Doxie_042D6A',
  firmwareWiFi: '1.29',
  hasPassword: false,
  MAC: '00:11:E5:04:2D:6A',
  mode: 'AP'
}

scanner_status (Only for Doxie Go Wi-Fi)

This method was deprecated for Doxie go SE, Doxie Q

returns

{
 "firmware": "0.26",
 "connectedToExternalPower": true
}

restart

returns 204 No Content and then restarts the scanner's Wi-Fi system. The scanner's status light blinks blue during the restart.

return doxie.restart().then(response);

list_all_scans

returns an array of all scans currently in the scanner’s memory. After scanning a document, the scan will available via the API several second later

return doxie.list_all_scans().then(response);

returns

[
  {
    name: '/DOXIE/JPEG/IMG_0001.JPG',
    size: 241220,
    modified: '2010-05-01 00:10:06'
  },
  {
    name: '/DOXIE/JPEG/IMG_0002.JPG',
    size: 265085,
    modified: '2010-05-01 00:09:26'
  },
  {
    name: '/DOXIE/JPEG/IMG_0003.JPG',
    size: 273522,
    modified: '2010-05-01 00:09:44'
  }
];

most_recent_scan

returns the path to the last scan if available. Monitoring this value for changes provides a simple way to detect new scans without having to fetch the entire list of scans.

return doxie.most_recent_scan().then(response);

returns

{
 "path":"/DOXIE/JPEG/IMG_0003.JPG"
}

get_scan

returns the scan at the specified path or 404 Not Found This method also will retry (default: 3) when a 404 is not found assuming the image is not ready.

params

  • scanPath required - String (ie. '/DOXIE/JPEG/IMG_0001.JPG')
  • retries optional - default: 3 - Number of retires to attempt when image is not ready
return doxie.get_scan('/DOXIE/JPEG/IMG_0001.JPG').then(response);

get_thumbnail

Thumbnails are constrained to fit within 240x240 pixels. Thumbnails for new scans are not generated until after the scan has been made available in get_scan() and most_recent_scan(). This function will return 404 Not Found if the thumbnail has not yet been generated. This method also will retry (default: 3) when a 404 is not found assuming the image is not ready.

params

  • scanPath required - String (ie. '/DOXIE/JPEG/IMG_0001.JPG')
  • retries optional - default: 3 - Number of retires to attempt when image is not ready
return doxie.get_thumbnail('/DOXIE/JPEG/IMG_0001.JPG').then(response);

returns on success the stream of the thumbnail

200

returns on failure

404 Not Found

delete_scan

deletes the scan at the specified path

return doxie.delete_scan('/DOXIE/JPEG/IMG_0001.JPG').then(response);

returns on success

204 No Content

when deleteing multiple scans use delete_mutiple_scans for the best performance.

delete_multiple_scans

deletes multiple scans in a single operation. This is much faster than deleting each scan individually. Multiple scans are referenced using a JSON array of paths

const scans = [
  '/DOXIE/JPEG/IMG_0001.JPG',
  '/DOXIE/JPEG/IMG_0002.JPG',
  '/DOXIE/JPEG/IMG_0003.JPG'
];
return doxie.delete_multiple_scans(scans).then(response);

returns on success

204 No Content

Development

  • yarn install
  • yarn test to run tests

deployment

  • npm version [minor, patch, major]
  • git push origin master --tag Auto publishes on tag commit to master. or
  • git push --follow-tags

This library is released under the MIT License

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.