Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
couchdb-mkdb
Advanced tools
Readme
couchdb-mkdb
makes it easy to create databases and stream couchdb's response.
$ npm i -S couchdb-mkdb
Express example
This express route creates new databases on every request.
...
app.post('/', (req, res, next) => {
let name = 'mydb-' + uuid.v1();
let opts = {
// `security` is a special option ...
security: {
admins: {names: [req.user.name], roles: []},
members: {names: [], roles: []}
},
// ... all other options are passed to the underlaying `request` function.
// See https://github.com/request/request#requestoptions-callback
baseUrl: app.get('couchdb'),
auth: app.get('auth')
};
// Use the mkdb utility to create the database
mkdb(name, opts)
.on('error', next)
.on('response', function(response) {
// For error handling check the statusCode
if ((response.statusCode / 100 | 0) !== 2) {
console.log('Database wasn\'t created or security couldn\'t be updated');
}
response.pipe(
res.set(response.headers)
.status(response.statusCode)
);
})
.on('success', function() {
// Event 'response' has already been emitted
console.log('Database successfully created');
});
});
name
The name of the databaseopts
Optional options object. See belowcallback
Function with the signature fn(error, response)
Available options are:
security
The security rules to apply to the database. See Couchdb securityAll other options are passed to the underlaying request() function.
error(err)
- Emitted on request errorerrorResponse(res)
- deprecated Emitted when couchdb returns a paranormal response. See Update notesresponse(res)
- Emitted when couchdb responds to the last actionsuccess
- Emitted on success$ git clone https://github.com/domachine/node-couchdb-mkdb.git
$ cd node-couchdb-mkdb
$ npm i
$ npm test
mkdb
now uses request as transport
engine. Therefore the options you can pass are similar to
request's options. See
docs.
The first version had an 'errorResponse' event. This has now been deprecated. Use the 'response' event instead and check the statusCode.
FAQs
Utility to create couchdb databases easier.
The npm package couchdb-mkdb receives a total of 5 weekly downloads. As such, couchdb-mkdb popularity was classified as not popular.
We found that couchdb-mkdb 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.