Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

about

Blindly corrupts images in string form.

setup

Download from GitHub directly:

# Add to package.json
npm install thewhodidthis/witz

usage

Works with Data URLs or plain base64 encoded strings and is Web Worker as well as Node.js compatible,

import witz from "@thewhodidthis/witz"
import fs from "fs"

const pimp = witz()
const save = (data, file = "./target.jpg") =>
  fs.writeFile(file, data, (error) => {
    if (error) {
      throw error
    }

    console.log("Done!")
  })

fs.readFile("./source.jpg", (error, data) => {
  if (error) {
    throw error
  }

  const master = Buffer(data).toString("base64")
  const sample = pimp(master)
  const result = Buffer.from(sample, "base64")

  save(result)
})

see also