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

blitline-resizer

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blitline-resizer - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

index.js

@@ -54,3 +54,3 @@ var Blitline = require('simple_blitline_node');

var secret = options.secret || crypto.randomBytes(32).toString('base64');
var secret = options.secret || config.secret || crypto.randomBytes(32).toString('base64');

@@ -57,0 +57,0 @@ var headers = {

{
"name": "blitline-resizer",
"version": "0.2.0",
"version": "0.2.1",
"description": "Resizes images using Blitline",

@@ -36,4 +36,4 @@ "main": "index.js",

"tap-spec": "^2.2.2",
"tape": "^3.0.3"
"tape": "^3.5.0"
}
}

@@ -65,2 +65,6 @@ [![Build Status](https://travis-ci.org/digidem/blitline-resizer.svg)](https://travis-ci.org/digidem/blitline-resizer)

### v0.2.1
Can set secret on initial config, rather than each task
### v0.2.0

@@ -67,0 +71,0 @@

@@ -124,9 +124,2 @@ var test = require('tape');

function createTimeout(t) {
return setTimeout(function() {
t.fail('Timeout waiting for blitline to process jobs');
t.end();
}, timeout);
}
test('Resizes a single image', function(t) {

@@ -143,3 +136,3 @@ var resize = Resizer(resizerDefaults),

resizeTask.timer = createTimeout(t);
t.timeoutAfter(timeout);

@@ -153,3 +146,2 @@ postbackCallback = function(err, req, res) {

t.deepEqual(resultsSizes.sort(), resizeTask.sizes.sort(), 'got the correct sizes back');
clearTimeout(resizeTask.timer);
t.end();

@@ -160,2 +152,28 @@ };

test('Resizes image from raw.github without correct headers', function(t) {
var resize = Resizer(resizerDefaults),
timer;
var resizeTask = {
images: [ "https://raw.githubusercontent.com/digidem-test/test/master/assets_other/14782435_9baff664f2_o_d.jpg" ],
sizes: [500]
};
resize(resizeTask, checkResizeReponse(t, resizeTask));
t.timeoutAfter(timeout);
postbackCallback = function(err, req, res) {
var results = req.body.results;
checkPostback(t, results);
var resultsSizes = results.images.map(function(image) {
return image.meta.width;
});
t.deepEqual(resultsSizes.sort(), resizeTask.sizes.sort(), 'got the correct sizes back');
t.end();
};
});
test('Resizes multiple images, returning a separate job for each image', function(t) {

@@ -172,3 +190,3 @@ var resize = Resizer(resizerDefaults),

resizeTask.timer = createTimeout(t);
t.timeoutAfter(timeout);

@@ -185,3 +203,2 @@ postbackCallback = function(err, req, res) {

t.pass('all jobs returned');
clearTimeout(resizeTask.timer);
t.end();

@@ -204,3 +221,3 @@ }

resizeTask.timer = createTimeout(t);
t.timeoutAfter(timeout);

@@ -221,3 +238,2 @@ postbackCallback = function(err, req, res) {

clearTimeout(resizeTask.timer);
t.end();

@@ -239,3 +255,3 @@ };

resizeTask.timer = createTimeout(t);
t.timeoutAfter(timeout);

@@ -251,3 +267,2 @@ postbackCallback = function(err, req, res) {

t.equal(dimensions.width, imagesMeta[images[0]].width, 'original present on s3');
clearTimeout(resizeTask.timer);
t.end();

@@ -267,2 +282,26 @@ });

test('Sets custom headers on the postback', function(t) {
var resize = Resizer(resizerDefaults),
timer;
var resizeTask = {
images: [ images[0] ],
sizes: [500],
postbackHeaders: {
'x-custom-header': 'my custom header'
}
};
resize(resizeTask, checkResizeReponse(t, resizeTask));
t.timeoutAfter(timeout);
postbackCallback = function(err, req, res) {
var results = req.body.results;
checkPostback(t, results);
t.equal(req.headers['x-custom-header'], 'my custom header', 'postback has custom header');
t.end();
};
});
test('Long polls for response if no postbackUrl is provided', function(t) {

@@ -287,2 +326,10 @@ var resize = Resizer({

t.equal(data[0].results.images.length, resizeTask.sizes.length, 'got correct number of images back');
// Files that need cleanup from s3
s3files = s3files.concat(data.reduce(function(p, c) {
return p.concat(c.results.images.map(function(image) {
return image.s3_url;
}));
}, []));
t.end();

@@ -289,0 +336,0 @@ });

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