![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
papercut
Advanced tools
Readme
Papercut handle image processing, versioning and storage for you, in node.js.
In terminal:
npm install papercut --save
var papercut = require('papercut');
papercut.configure(function(){
papercut.set('storage', 'file')
papercut.set('directory', './images/uploads')
papercut.set('url', '/images/uploads')
});
papercut.configure('production', function(){
papercut.set('storage', 's3')
papercut.set('S3_KEY', process.env.S3_KEY)
papercut.set('S3_SECRET', process.env.S3_SECRET)
papercut.set('bucket', 'papercut')
});
AvatarUploader = papercut.Schema(function(schema){
schema.version({
name: 'avatar',
size: '200x200',
process: 'crop'
});
schema.version({
name: 'small',
size: '50x50',
process: 'crop'
});
});
uploader = new AvatarUploader();
uploader.process('image1', file.path, function(images){
console.log(images.avatar); // '/images/uploads/image1-avatar.jpg'
console.log(images.small); // '/images/uploads/image1-small.jpg'
})
In papercut, you can set the image directory and default process by getter and setter:
var papercut = require('papercut');
//storage type, have file and s3
papercut.set('storage', 'file');
//directory for saving image
papercut.set('directory', './images/uploads');
//url path to the directory
papercut.set('url', '/images/uploads');
//set output images extension
papercut.set('extension', 'jpg');
Also, you can set the environment dependent configuration, it detect the process.env.NODE_ENV
param.
you can call export NODE_ENV=[environment]
to change environment.
papercut.configure('production', function(){
//set storage to s3 for production environment
papercut.set('storage', 's3');
//set s3 key from environment.
papercut.set('S3_KEY', process.env.S3_KEY);
papercut.set('S3_SECRET', process.env.S3_SECRET);
//s3 bucket name
papercut.set('bucket', 'papercut');
});
After configuration, you can create an uploader to process images with multiple version by Schema
var Uploader = papercut.Schema(function(schema){
schema.version({
name: 'thumbnail',
size: '45x45',
process: 'crop'
});
schema.version({
name: 'large',
size: '600x480',
process: 'resize'
});
schema.version({
name: 'origin',
process: 'copy'
});
});
With uploader, you can pass the image identifier and image path to process images.
Also with images url in different versions:
var uploader = new Uploader();
uploader.process('412341', '/tmp/13912304.jpg', function(err, images){
console.log(images);
// {
// thumbnail: '/images/upload/412341-thumbnail.jpg',
// large: '/images/upload/412341-large.jpg',
// origin: '/images/upload/412341-origin.jpg'
// }
});
##Express
Check out the express example in project for how to use it in express framework.
FAQs
Papercut is a node package to handle image upload, resize and sync with Amazon s3
The npm package papercut receives a total of 3 weekly downloads. As such, papercut popularity was classified as not popular.
We found that papercut demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.