sendgrid-stream

0.1.1 • Public • Published

sendgrid-stream

A simple Transform stream that sends the data it recieves in an email using sendgrid-web. It is recommended that you have a filtering stream of sorts before piping to this :).

install

npm install sendgrid-stream

Example

var sendgridStream = require('../');
 
//
// Instantiates the stream with `sendgrid-web` info
//
var stream = sendgridStream({
  auth: {
    user: 'username',
    key: 'password'
  },
  to: 'devops@domain.com',
  from: 'service@domain.com',
  subject: 'Error'
});
 
//
// Log any errors to the console
//
stream.on('error', console.error.bind(console));
 
var data = {
  key: 'value',
  otherKey: 'otherValue'
};
 
//
// Same data is passed through to the otherside of the stream
//
stream.on('readable', function () {
  var thing = stream.read();
  console.log(thing);
});
 
//
// This will trigger an email to be sent with the `data` object
//
stream.write(data);

test

npm test

license

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i sendgrid-stream

Weekly Downloads

2

Version

0.1.1

License

MIT

Last publish

Collaborators

  • jcrugzz