Neverending Package Mountain

    @randy.tarampi/pseudoimage

    4.0.0 • Public • Published

    ʕつ◕ᴥ◕ʔつ 📷 → Your application's pseudolocales' image folders

    npm versions npm downloads npm bundle size (minified) npm bundle size (minified + gzip) npm license Build status Build status Coverage status Maintainability status Analytics

    Install @randy.tarampi/pseudoimage

    This uses @randy.tarampi/lwip to modify your images to create a fake, which gets saved somewhere.

    Usage

    let Pseudoimage = require("@randy.tarampi/pseudoimage");
    let sourceDirectory = "/Users/randy.tarampi/Desktop/images";
    let destinationDirectory = "/Users/randy.tarampi/Desktop/fakeImages";
    let expect = require("chai").expect;
    
    let pseudoimage = new Pseudoimage(sourceDirectory, destinationDirectory);
    pseudoimage.generatePseudoImages();
    
    // There should be a copy for each supported image in `sourceDirectory` in `destinationDirectory`
    let files = fs.readdirSync(sourceDirectory);
    files.map((file) => {
    	openImage(file)
    		.then((image) => {
    			expect(images[0].width()).to.eql(images[1].width());
    			expect(images[0].height()).to.eql(images[1].height());
    		})
    		.catch((error) => {
    			console.error(error); // Shouldn't see any errors
    		});
    });
    
    function openImage(imagePath) {
    	return new Promise((resolve, reject) => {
    		pseudoimage.open(imagePath, (error, image) => {
    			if (error) {
    				reject(error);
    				return;
    			}
    			resolve(image);
    		})
    	});
    }

    Install

    npm i @randy.tarampi/pseudoimage

    DownloadsWeekly Downloads

    209

    Version

    4.0.0

    License

    MIT

    Unpacked Size

    702 kB

    Total Files

    8

    Last publish

    Collaborators

    • randy.tarampi