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

immerdu

v2.4.1

Published

Use immerdu from node.

Downloads

33

Readme

node immerdu

immerdu for node.

Installation

npm install immerdu

Usage

var nacl = require('tweetnacl')
var immerdu = require('immerdu')

var server = 'http://localhost:5984'
var username = 'my-account'
var filename = '/path/to/an/image.jpg'

api.signup(server, username, function(err, response) {
  api.signin(server, username, response.accountKey, function(err, dbkey) {
    api.upload(server, username, dbkey, filename, function(err) {
      api.thumbs(server, username, dbkey, 'x256', function(err, response) {
        // response is a couchdb view response
        // with decrypted thumbnails
      })
    })
  })
})

API

Sign Up

signup(server, username, accountKey, callback)

Create permit. If the database does not exist, it gets created. If no accountKey is given, a new key gets created.

  • server: couchdb server url
  • username: account name
  • accountKey: account key pair (optional. if given, only public key required)

callback(err, response) is called with permit id, dbKey and accountKey on success:

{
  ok: true,
  id: '3d132659-0b26-4f50-92c5-de4c63ffa3c5',
  accountKey: {
    publicKey: ...,  // Uint8Array with 32-byte public key
    secretKey: ...   // Uint8Array with 32-byte secret key
  },
  dbKey: {
    publicKey: ...,  // Uint8Array with 32-byte public key
    secretKey: ...   // Uint8Array with 32-byte secret key
  }
}

Sign In

signin(server, username, accountKey, callback)

Open immerdu database.

  • server: couchdb server url
  • username: account name
  • accountKey: account key pair (only secret key required)

callback(err, response) is called with the database key pair on success:

{
  publicKey: ...,  // Uint8Array with 32-byte public key
  secretKey: ...   // Uint8Array with 32-byte secret key
}

Upload

upload(server, username, dbKey, filename, options, callback)

Import an image.

  • server: couchdb server url
  • username: account name
  • dbKey: database key pair (only public key required)
  • filename: filename of the image
  • options.overwrite: reimport existing images
  • options.exclude: array of versions which should not be imported

callback(err, response) is called with the photo id on success:

{
  ok: true,
  id: 'de59be4c5a2e0ec09246b7210dfd6d5634421188'
}

Thumbs

thumbs(url, username, dbKey, size, options, callback)

Retrieve an index with thumbnails.

  • server: couchdb server url
  • username: account name
  • dbKey: database key pair (both public and secret keys are required)
  • size: thumbnails size can be x256 or 256x256
  • options: CouchDB view query options, except startkey and endkey

callback(err, response) is called with the thumbnails view response on success:

{
  total_rows: 2,
  offset: 1,
  rows: [
    {
      id: 'photo/de59be4c5a2e0ec09246b7210dfd6d5634421188',
      key: [
        kz8O8lMMAs1nQYIgckje4FLMDVqJaePyUnsG2v9OT3M=',
        x256',
        2014:11:12 13:04:00'
      ],
      value: {
        photoKey: 'aEOUhJwLn4OTMdzGa3bbK5L6BqI2w21vYIt4KuiayzM=',
        image: {
          format: 'jpeg',
          width: 384,
          height: 256,
          buffer: ...  // Buffer with image data
        }
      }
    }
  ]
}

Images

images(server, username, dbKey, ids, size, callback)

Retrieve photos.

  • server: couchdb server url
  • username: account name
  • dbKey: database key pair (both public and secret keys are required)
  • ids: photo id or array of photo ids
  • size: image size can be 1920x1080 or original

callback(err, response) is called with the images view response on success:

{
  total_rows: 1,
  offset: 0,
  rows: [
    {
      id: 'photo/de59be4c5a2e0ec09246b7210dfd6d5634421188',
      key: [
        Xz65xL8uqkKx26ea8l/ff0Pb1DMOb7WJoj9qC/WAMEw=',
        de59be4c5a2e0ec09246b7210dfd6d5634421188'
      ],
      value: {
        photoKey: 'FRZRp7SpK84KSe9DhjEq2ZaOE+FoBz3rcZ7KB3Iruig=',
        image: {
          format: 'jpeg',
          width: 600,
          height: 400,
          buffer: ...  // Buffer with image data
        }
      }
    }
  ]
}

Tests

Run the testsuite with npm test or a single test with node test/lib/test-signin.js

(c) 2014 Johannes J. Schmidt