New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

couchbase-promises

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

couchbase-promises

An A+ Promises wrapper for the Couchbase SDK.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-90.2%
Maintainers
1
Weekly downloads
 
Created
Source

Couchbase Promises

A lightweight, drop-in replacement for the Couchnode module with added support for A+ Promises.

Build Status

Overview

Just like the Couchbase Node.js module, but with the addition of *Async() methods that return A+ Promises for all methods that contain a Node.js callback parameter. Both the normal Couchnode and the mock Couchnode APIs have been fully promisified.

The current version supports Couchbase Node.js SDK version 2.1.2.

Promises are created using the Bluebird Promises library.

General Usage

Usage is almost exactly the same as the native SDK, but with the added ability to use Promises instead of callbacks.

A user repository module with a simple lookup...

var couchbase = require('couchbase-promises');
var cluster = new couchbase.Cluster('couchbase://127.0.0.1');
var bucket = cluster.openBucket();

function UserNotFoundError() {
  Error.call(this);
  Error.captureStackTrace(this, UserNotFoundError);
  this.message = "User not found.";
}

module.exports = {
  UserNotFoundError: UserNotFoundError,
  getUserAsync: function(userId) {
    return bucket.getAsync(userId)
      .then(function(result) {
        return {
          user: result.value,
          meta: {
            etag: result.cas
          }
        };
      }).catch(couchbase.Error, function(e) {
        if (e.code == couchbase.errors.keyNotFound)
          throw new UserNotFoundError();

        throw e;
      });
  }
};

Keywords

FAQs

Package last updated on 17 Nov 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc