All Projects → apb2006 → basex-node

apb2006 / basex-node

Licence: BSD-3-Clause license
A node.js client for the BaseX server.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to basex-node

xquery-intellij-plugin
XQuery, XPath and XSLT Language Support for the IntelliJ IDE
Stars: ✭ 24 (-31.43%)
Mutual labels:  basex
python-baseconv
Python module to convert numbers from base 10 integers to base X strings and back again.
Stars: ✭ 40 (+14.29%)
Mutual labels:  basex
basex-rdf
RDF parsing for BaseX
Stars: ✭ 16 (-54.29%)
Mutual labels:  basex
synopsx
SynopsX is a lightweight XML publishing framework
Stars: ✭ 13 (-62.86%)
Mutual labels:  basex
xqdoc
An Antlr4 implementation of xqDoc for XQuery
Stars: ✭ 14 (-60%)
Mutual labels:  basex
XQuery4Humanists
Exercises for the XQuery Workshops at XQuery at DH2017
Stars: ✭ 42 (+20%)
Mutual labels:  basex
BaseNcoding
Library for encoding of binary data into strings using base32, base85, base128 and other algorithms.
Stars: ✭ 42 (+20%)
Mutual labels:  basex

basex - A BaseX client for node.js

===========================

This is a BaseX client for Node.js. It uses the client interface via a socket connection to the BaseX server.

BaseX is a very light-weight, high-performance and scalable XML Database engine and XPath/XQuery 3.0 Processor, including full support for the W3C Update and Full Text extensions. Built as a lightweight Java server, BaseX also supports XSLT, Webdav and RestXQ.

Installing the BaseX Node client

Npm package monthly downloads

To install with npm:

npm install basex

	$ mkdir myproject
	cd myproject
	$ npm install basex
	[email protected] ./node_modules/basex 

Once BaseX is installed and the BaseX server is running, test it.

	$ cd examples/
	$ node Example.js 
	milliseconds: 0
	{ result: '1 2 3 4 5 6 7 8 9 10',
	  info: '\nQuery executed in 0.38 ms.\n' }
	end
	close

Installing BaseX

  1. Java is required
  2. Download and install BaseX (tested against versions 9.6,8.6)
  3. Run basexserver -S

API specification

See commands.md in the docs folder for details of the API.

Tests

There is a test suite using mocha , should and sinon.

mocha -R spec test/ 

 [auth] password good
    √ should not error

  [auth] password bad
    √ should throw error

  [commands] Execute info command
    √ should not error
    √ should have reply

  [commands] Send valid xquery statement:  2+2
    √ It should not error
    √ It should equal 4

  [commands] Send an invalid command:  2+
    √ It should  error

  [commands] Create a database testdb using execute
    √ It should not error

  [commands] Add a document
    √ It should not error

  [commands] Add an invalid document
    √ It should error

  [commands] drop db testdb
    √ It should not error

  [commands] create database
    √ It should not error

  [commands] drop db database
    √ It should not error

  [parser] Parser test?
    √ should pop abc

  [query] create query and bind
    √ It should not error
    √ It should return a string

  [query] create query and bind with type
    √ It should not error
    √ It should return a string

  [query] Send a xquery and iterate over the result items
    √ It should not error
    √ It should return an array

  [stream] Create a database testdb from stream
    √ It should not error

  [stream] Add doc from stream
    √ It should not error

  [stream] drop db testdb
    √ It should not error

  [stress] Send a xquery and iterate over the 1000000 result items
    √ should not error

  [stress] return megabyte result from execute
    √ should not error

  [stress] return megabyte result from query
    √ should not error


  26 passing (2s)

Tools

Javascript is formated using js-beautify js-beautify -r index.js

Documentation is generated using jsdoc -r -d docs --verbose index.js

Contributing

Anyone is welcome to submit issues and pull requests

Thanks to:

Todo

  • stream i/o
  • reconnect

Alternative clients

Inspiration

Parts inspired by node_redis, BaseX Java client

License

BSD license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].