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

mailgun-js

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailgun-js - npm Package Compare versions

Comparing version 0.4.8 to 0.4.9

2

lib/attachment.js

@@ -8,3 +8,3 @@ /**

function Attachment(data, filename) {
if (Buffer.isBuffer(data)) {
if (typeof data === 'string' || Buffer.isBuffer(data)) {
this.data = data;

@@ -11,0 +11,0 @@ }

@@ -13,6 +13,7 @@ var inflection = require('inflection');

Builder.prototype.build = function () {
for (var key in this.resources) {
var self = this;
Object.keys(this.resources).forEach(function (key) {
//console.log('building ' + key);
this.buildResource(this.resources[key]);
}
self.buildResource(self.resources[key]);
});
};

@@ -19,0 +20,0 @@

@@ -1,2 +0,1 @@

var path = require('path');
var Attachment = require('./attachment');

@@ -29,3 +28,7 @@ var Request = require('./request');

Mailgun.prototype.request = function (method, resource, data, fn) {
var fullpath = path.join('/', this.getDomain(resource), resource);
var fullpath = resource;
var domain = this.getDomain(resource);
if (domain) {
fullpath = '/'.concat(domain, resource);
}

@@ -32,0 +35,0 @@ var req = new Request({auth: this.auth});

@@ -129,3 +129,6 @@ var https = require('https');

else if ((typeof obj === 'object') && (obj instanceof Attachment)) {
if (obj.data && Buffer.isBuffer(obj.data)) {
if (typeof obj.data === 'string') {
this.form.append(key, fs.createReadStream(obj.data), {filename: obj.filename || 'file'});
}
else if (Buffer.isBuffer(obj.data)) {
this.form.append(key, obj.data, {filename: obj.filename || 'file'});

@@ -132,0 +135,0 @@ }

@@ -5,3 +5,3 @@ {

"keywords": ["email", "mailgun"],
"version": "0.4.8",
"version": "0.4.9",
"homepage": "https://github.com/1lobby/mailgun-js",

@@ -44,2 +44,5 @@ "license": "MIT",

"name": "Serhiy Oplakanets"
},
{
"name": "Julien Faissolle"
}

@@ -46,0 +49,0 @@ ],

@@ -123,4 +123,4 @@ # mailgun.js

Finally we provide a `Mailgun.Attachment` class to add attachment and specify both the buffer and filename data.
Finally we provide a `Mailgun.Attachment` class to add attachment and specify both the data source and filename.
The first constructor argument can be either a `Buffer` or a `string` (file path).
```js

@@ -127,0 +127,0 @@ var filename = '/mailgun_logo.png';

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