🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

icns-lib

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

icns-lib

Library to read and create .icns files

1.0.1
latest
Source
npm
Version published
Weekly downloads
1.1K
-14.09%
Maintainers
1
Weekly downloads
 
Created
Source

icns-lib Build Status

Read and creare Apple Icon Image format files

Parse a buffer into a useful structure with each icon type and its data and convert that structure into a buffer to save it back to a valid .icns.

Install

Ensure you have Node.js 8 or later installed. Then run the following:

$ npm install icns-lib

Usage

const fs = require('sf');
const icns = require('icns-lib');

const buffer = fs.readFileSync('icons.icns')

// Parse the buffer into a map where the key is the Icon type (icp4, icp5, etc) and the value is a buffer with the data.
const icons = icns.parse(buffer);

Object.keys(icons).forEach(type => {
	// Remove all items that are not an image type icon
	if (!icns.isImageType(type)) {
		delete icons;
	}
})

// Save the icon set without all the non-image icons
fs.writeFileSync('icons.icns', icns.format(icons))

License

MIT © Manuel Rueda

Keywords

lib

FAQs

Package last updated on 27 Jan 2019

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