Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
simple-basex
Advanced tools
simple-basex attempts to implement a simple to use client interface to the BaseX XML database. It deviates from the client API proposed in the BaseX documentation in particular with respect to the bound query interface.
simple-basex is self contained and uses only core Node.JS functionality. It can be installed using npm:
npm install basex
A simple test script is provided which requires a BaseX server running on the local machine. By default, the username "admin" and the password "admin" are used to access BaseX. See "Environment Variables" below if you need to use different credentials.
simple-basex implements a client interface that is simple to use in the asynchronous context of Node.JS. Commands can be sent to the database server without waiting for responses. Responses can either be collected by callbacks, or by the way of events emitted by the client session object.
A example might look like this:
var basex = require('simple-basex');
var s = new basex.Session();
s.execute('open mydatabase');
s.query('//product', function (err, result) {
if (err) throw err;
console.log('product', result);
});
All interaction with BaseX is mediated through a Session object which
needs to be allocated using the new
operator. Database commands can
be executed through the execute
function. Queries are typically
sent using the query
function, which also supports bound variables.
The authentication credentials used to log in to the BaseX server can
be supplied to the Session
constructor. If no explicit credentials
are provided, the built-in defaults of simple-basex can be overridden
using the following environment variables:
Sets the host on which the BaseX server runs, defaults to localhost
.
Port number of the BaseX server, defaults to 1984.
User name, defaults to admin
.
Password, defaults to admin
.
Creates a new database client session. options
can be passed to
override the default and environment credentials. It needs to be an
object with any of the host
, port
, username
or password
keys
set to the desired value.
The returned session object handles the context for all database interactions.
Execute the command
on the database server. Upon completion, the
handler callback is invoked with two arguments. The first argument is
either null or an Error object if an error occured executing the
command. The second argument is an object with reply
and info
keys which contain the data that the command yielded and the
diagnostic information for the command execution, respectively. If no
handler is provided, an 'error' or 'result' event will be emitted by
the Session object.
Execute the query
, which needs to contain an XQuery string.
bindings
can contain variable bindings which need to be passed as
object. The data types of the bound variables will be automatically
determined from the value types in the bindings
object.
handler
is an optional handler with the conventional (err, data)
signature. err
will be an Error object if an error occured during
query execution. data
will contain the result string. Query
diagnostics are not currently returned for bound query execution.
FAQs
Simple BaseX client
The npm package simple-basex receives a total of 2 weekly downloads. As such, simple-basex popularity was classified as not popular.
We found that simple-basex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.