New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details → →
Socket
Book a DemoSign in
Socket

basex-stream

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basex-stream

BaseX client using node streams

latest
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

basex-stream

BaseX client for nodeJS using streams and promises.

Usage

var basex = require("basex-stream");
var session = basex({
	host: "127.0.0.1",
	port: 1984,
	user: "admin",
	pass: "admin"
});

Create

Create new databases with

session.create("test");

Commands

Issue a database command with

session.command("LIST")
.spread(function (output, info) {
	console.log(output);
});

or get a streamable response by using the promise's out property

var p = session.command("LIST");
p.out.pipe(process.stdout);
p.then(function (output, info) {
	// Now that the output stream is consumed output is null
	console.log("The string was consumed, thus output is " + output);
});

Resources

Add new resources to a database with

session.store("test.txt", "Hello World!");

or pipe in a Readable stream directly

var fs = require("fs");
var input = fs.createReadStream("test.txt");

session.store("test.txt", input);

Queries

session.query("1 to 1000")
.then(function (q) {
	return q.results(function (type, data) {
		console.log(type, data.toString());
	})
	.then(function (results) {
		console.log("Found " + results.count + " results.");
	})
	.then(function () {
		q.close()
	});
})
.catch(function (error){
	console.error(error);
});

FAQs

Package last updated on 10 Jun 2015

Did you know?

Socket

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.

Install

Related posts