JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q36618F
  • License MIT

A lightweight image cropping tool and thumbnail generator for Node.js

Package Exports

  • pushpop

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pushpop) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#pushpop

A lightweight image cropping tool and thumbnail generator for Node.js

##Configuration

var pushpop = require('pushpop');

pushpop.config({

// [required] set the global upload directory //
    uploads:path.join(__dirname, '..', '/uploads'),

// [optional] overwrite file names with unique ids //
    uniqueIds:true,

// [optional] enable logging //
    enableLogs:true,

// [optional] save files to gcloud instead of the local filesystem //
    service: { name:'gcloud', bucket:'pushpop'}
})

##Handling Uploads

pushpop is middleware that intercepts incoming POST requests that contain image data and generates a thumbnail from the metadata contained in the request. It then saves both the source image and thumbnail to a local or remote location of your choosing.

To use it simply add it to your POST request handler like so:

app.post('/upload', pushpop.upload, function(req, res)
{
    if (!pushpop.error){
        res.send('ok').status(200);
    }	else{
        res.send(pushpop.error).status(500);
    }
});

Source & Documentation