Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

imapper-storage-memory

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imapper-storage-memory

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

  • 0.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 29 Feb 2016

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