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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@independentsoft/msg

v1.0.2

Published

Outlook .msg file module

Readme

This module allows you to easy create, read, update and parse Outlook message files.

Features

  • Create message, appointment, task, contact or any other Outlook item.
  • Read any Outlook .msg file and get all properties.
  • Set/Get MAPI properties.
  • Set/Get named properties.
  • Add attachments.
  • Read attachments.
  • Save attachments.
  • Add embedded messages.
  • Read embedded messages.
  • Save embedded messages.

###Examples

#####Create message 

import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';

let recipient1 = new msg.Recipient();
recipient1.addressType = "SMTP";
recipient1.displayType = msg.DisplayType.MAIL_USER;
recipient1.objectType = msg.ObjectType.MAIL_USER;
recipient1.displayName = "[email protected]";
recipient1.emailAddress = "[email protected]";
recipient1.recipientType = msg.RecipientType.TO;

let recipient2 = new msg.Recipient();
recipient2.addressType = "SMTP";
recipient2.displayType = msg.DisplayType.MAIL_USER;
recipient2.objectType = msg.ObjectType.MAIL_USER;
recipient2.displayName = "[email protected]";
recipient2.emailAddress = "[email protected]";
recipient2.recipientType = msg.RecipientType.CC;

let message = new msg.Message();
message.subject = "Test";
message.body = "Body text";
message.displayTo = "John Smith";
message.displayCc = "Mary Smith";
message.recipients.push(recipient1);
message.recipients.push(recipient2);
message.messageFlags.push(msg.MessageFlag.UNSENT);
message.storeSupportMasks.push(msg.StoreSupportMask.CREATE);

fs.writeFileSync("e:\\message.msg", message.toBytes());

#####Create HTML message 

import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';

let recipient1 = new msg.Recipient();
recipient1.addressType = "SMTP";
recipient1.displayType = msg.DisplayType.MAIL_USER;
recipient1.objectType = msg.ObjectType.MAIL_USER;
recipient1.displayName = "[email protected]";
recipient1.emailAddress = "[email protected]";
recipient1.recipientType = msg.RecipientType.TO;

let recipient2 = new msg.Recipient();
recipient2.addressType = "SMTP";
recipient2.displayType = msg.DisplayType.MAIL_USER;
recipient2.objectType = msg.ObjectType.MAIL_USER;
recipient2.displayName = "[email protected]";
recipient2.emailAddress = "[email protected]";
recipient2.recipientType = msg.RecipientType.CC;

const htmlBody = "<html><body><b>Hello World bold html text</b></body></html>"
const htmlBodyWithRtf = "{\\rtf1\\ansi\\ansicpg1252\\fromhtml1 \\htmlrtf0 " + htmlBody + "}"
const rtfBody = new TextEncoder().encode(htmlBodyWithRtf)

let message = new msg.Message();
message.subject = "Test";
message.body = "Body text";
message.displayTo = "John Smith";
message.displayCc = "Mary Smith";
message.recipients.push(recipient1);
message.recipients.push(recipient2);
message.bodyTtmlText = htmlBody
message.bodyRtf = rtfBody
message.messageFlags.push(msg.MessageFlag.UNSENT);
message.storeSupportMasks.push(msg.StoreSupportMask.CREATE);

fs.writeFileSync("e:\\message.msg", message.toBytes());

#####Read message 

import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';

const buffer = fs.readFileSync('e:\\unicode.msg');
const message = new msg.Message(buffer)

console.log("Subject: " + message.subject);
console.log("Sender name: " + message.senderName);
console.log("Sender email address: " + message.senderEmailAddress);
console.log("Received by name: " + message.receivedByName);
console.log("Received by email address: " + message.receivedByEmailAddress);
console.log("Sent time: " + message.clientSubmitTime);
console.log("Received time: " + message.messageDeliveryTime);
console.log("Display to: " + message.displayTo);
console.log("Display cc: " + message.displayCc);
console.log("Body: " + message.body);

#####Add attachment 

import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';

const buffer = fs.readFileSync("e:\\test.pdf");
let attachment = new msg.Attachment(buffer);
attachment.fileName = "test.pdf";
attachment.displayName = "test.pdf";

let message = new msg.Message();
message.subject = "Test";
message.body = "Body text";
message.messageFlags.push(msg.MessageFlag.UNSENT);
message.storeSupportMasks.push(msg.StoreSupportMask.CREATE);
message.attachments.push(attachment)

fs.writeFileSync("e:\\message.msg", message.toBytes());

#####Get attachments 

import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';

const buffer = fs.readFileSync("e:\\message.msg");
const message = new msg.Message(buffer);

for(let i=0; i < message.attachments.length; i++) {
    const attachment = message.attachments[i];
    fs.writeFileSync("e:\\temp\\" + attachment.longFileName, attachment.toBytes());
}

#####Create appointment 

import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';

let appointment = new msg.Message()
appointment.messageClass = "IPM.Appointment";
appointment.subject = "Test";
appointment.body = "Body text";
appointment.location = "My Office";
appointment.appointmentStartTime = new Date(2020,11,10,8,0,0);
appointment.appointmentEndTime = new Date(2020,11,10,10,0,0);

fs.writeFileSync("e:\\appointment.msg", appointment.toBytes());

#####Create contact 

import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';

let contact = new msg.Message()
contact.messageClass = "IPM.Contact";
contact.subject = "John Smith";
contact.displayNamePrefix = "Mr.";
contact.displayName = "John Smith";
contact.givenName = "John";
contact.surname = "Smith";
contact.companyName = "Independentsoft";
contact.email1Address = "[email protected]";
contact.email1DisplayAs = "John";
contact.email1DisplayName = "John";
contact.email1Type = "SMTP";
contact.businessAddressCity = "NY";
contact.businessAddressStreet = "First Street";
contact.businessAddressCountry = "USA";
contact.businessAddress = "First Street, NY, USA";
contact.businessPhone = "555-666-777";

fs.writeFileSync("e:\\contact.msg", contact.toBytes());