npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

datamosh

v2.1.3

Published

Edit images via buffers.

Downloads

23

Readme

Datamosh License: MIT code style: prettier Build Status

datamosh_cover_2x

Mess around with image data using buffers, create some interesting & artistic results, profit.

Install

$ npm install datamosh

Usage

const mosh = require("datamosh");

let imgBuff = await readFile("/full/path/to/image.png");

let moshedBuff = await mosh(imgBuff, "vaporwave");

Reading/Writing the moshed image

mosh("~/image.png", null, "~/moshed_image.png");

// because mode is null, a random mode will be chosen

Moshing a buffer with callbacks

const cb = (err, data) => {
  if (!err) writeFile("/path/to/out.gif", data);
};

mosh(imgBuff, "vana", cb);

Using multiple modes on a single image, applied with respect to order.

let moshedBuff = await mosh(imgBuff, ["fatcat", "vaporwave", "walter"]);

// ['vana', null, null] is also valid => ['vana', random, random]

API

mosh(source, mode?, cb|writePath?)

Takes input source Buffer/Path, returns an encoded Buffer with the applied modes.

  • mode, the mosh mode to apply to the source image. Multiple modes may be passed using an array of modes. Any null values are replaced with a random mode.
  • cb (err, data), when using callbacks.
  • writePath, the path to write the moshed image to.

Paths may use the tilde (~) character. Datamosh validates read and write paths, replacing tilde with the path to the home directory.

~/Desktop/moshes/ -> /home/youruser/Desktop/moshes

Custom Modes

Datamosh allows you to set custom moshing modes. As of v1.1.0, this may be acomplished by adding a mosh function to the MODES property.

For mosh function starter code, see the included template file located here.

const datamosh = require("datamosh");

function newMode(data, width, height) {
  // your cool code goes here!

  return data;
}

datamosh.MODES.newMode = newMode;

Example Images

mode:fatcat Fatcat was created by user @mster

mode:vaporwave Vaporwave was created by user @tlaskey

mode:blurbobb

mode:veneneux

Datamosh in the wild

Check out this list of awesome apps that use datamosh!