Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pnkg

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

pnkg

PNG bundler

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

PNKG Build Status

Pnkg logo

Definition in brief:

Pnkg is a node module that allows you to package arbitrary files into PNG bundles.

Installation Instructions:

Install as a node module, from commandline type:

npm install pnkg
const fs = require("fs")
const {PNG} = require("pngjs")
const {pack, unpack} = require("pnkg")

Install as a commandline module globally type:

npm install —global pnkg
Usage: pnkg [options] [command]
Commands:
  pack [options] <file>
  unpack <file>
  help [command] display help for command

Documentation

(Coming soon)

Examples

Packing files

fs.createReadStream("<image_path>")
.pipe(new PNG())
.on("parsed", function() {
    // read file payload
    fs.readFile("<data_file_path>", function (error, file_data) {
        if (error) {
            throw new Error(error)
        }
        // override image data with pnkged data.
        this.data = pack(new Uint8Array(this.data), new Uint8Array(file_data))
        this.pack()
        .pipe(fs.createWriteStream("<destination_path>"))
    })
})

Unpacking data

fs.createReadStream("<destination_path>")
.pipe(new PNG())
.on("parsed", function() {
    fs.writeFile("<data_file_path>"), unpack(new Uint8Array(this.data)), function(error) {
        if (error) {
            throw new Error(error)
        }
    }
})

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

License

Copyright (c) 2021 John swana
Licensed under the MIT license.

FAQs

Package last updated on 19 May 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc