npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@quodatum/basex

v1.1.2

Published

A BaseX (XML database) client library

Downloads

23

Readme

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 @quodatum/basex

	$ mkdir myproject
	cd myproject
	$ npm install @quodatum/basex
	@quodatum/[email protected] ./node_modules/@quodatum/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 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

  • https://github.com/alxarch/basex-stream
  • https://github.com/nerdenough/node-basex
  • https://github.com/hanshuebner/simple-basex

Inspiration

Parts inspired by node_redis, BaseX Java client

License

BSD license