New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

idol

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idol

auto svg to png converter with caching and stepped sizing.

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

idol

auto svg to png converter with caching and stepped sizing.

usage

npm install idol
var path = require('path'),
    publicPath = path.join(__dirname, '../../public'),
    imagesDirectory = path.join(publicPath, './images'),
    idol = require('idol')(
        imagesDirectory, 
        './generated',
        {
            min: 10, // Minimum size a png can be
            max: 2000, // Maximum size a png can be
            scalar: 1.5  // Scale of each step the sizes can be
        }
    );


    ... later ...

        GET: function(request, response){
            var size = get requested image size form querystring perhaps?,
                imagePath = get imagepath from request.url somehow.;

            idol(
                imagePath, 
                {
                    width: size.width,
                    height: size.height
                },
                function(error, pngFilePath){
                    if(error){
                        console.log(error);
                        return;
                    }

                    // redirect the request to the generated file.
                    response.writeHead(301, {
                      'Location': path.relative(imagesDirectory, pngFilePath)
                    });
                    response.end();
                }
            );
        }
    };


FAQs

Package last updated on 25 Nov 2014

Did you know?

Socket

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.

Install

Related posts