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

imapper-storage-memory

v0.6.2

Published

Memory storage plugin for Imapper https://github.com/deitch/imapper

Downloads

4

Readme

imapper Storage Memory Plugin

This module provides a storage plugin for imapper where all of the folders and messages are stored in memory. That means that when you stop the process, they are lost entirely. This primarily is useful for testing.

Usage

Install with npm install:

npm install imapper-storage-memory

and then require it:

var storage = require('imapper-storage-memory'),
server = imapper({
	storage: storage
});

Loading and Modifying Data

The memory storage plugin by default loads an "INBOX" with no messages, and a "" namespace with no folders. This leaves it clean for you to load data as you wish.

All IMAP commands executed will perform on the in-memory data. You can reset the data at any time by calling reset():

var storage = require('imapper-storage-memory'),
server = imapper({
	storage: storage
});
storage.reset();

To load specific data, you call the load() command with the desired data:

var storage = require('imapper-storage-memory'),
server = imapper({
	storage: storage
});
storage.load(data);

The data provided is a javascript object. Each key is the name of a namespace. Under each namespace you can create folders. "INBOX" is special, in that it is both a namespace and a folder.

Namespaces

Namespaces are the root level of the data. Folders are contained only within namespaces, except for the "INBOX" namespace, which is both namespace and folder.

Namespaces have the following properties:

  • type: What type of namespace this is, can be one of "personal", "shared", "users". Default is "personal".
  • separator: What the separator between levels of folders is. Default is '/'. For example, if folder5 is a child of folder2, and the IMAP user will call them 'folder2/folder5', then the separator is '/'. '/' is common for mail folders, while '.' is common for newsgroups.
  • folders: The folders in this namespace.

Folders

Each folder is an object which has the following allowed properties as keys:

  • folders: Object. Further subfolders in this folder or namespace.
  • messages: Array. Message objects in this folder.
  • subscribed: boolean. If the user subscribed to this folder using the IMAP SUBSCRIBE command. Default is false, except for INBOX, where the default is true.

Note that folders can be nested several levels deep, for example:

{"":{
    "folders": {
      "level1": {
        "folders": {
          "level2": {
            "folders": {
              "level3": {
                "folders": {
                  "level4": {
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Messages

Each message in a folder's message array is an object, consisting of the following keys:

  • raw: The raw text of the messages, in its entirety.
  • internaldate: The internal date of the message, as stored by the IMAP server, in DD-MMM-YYYY format per RFC3501.
  • flags: A string (for a single flag) or an array of strings (for multiple flags) stored on this message.