ICO file format parser and builder.
npm install @igor-arkhipov/ico
import fs from 'fs'
import { Ico } from '@igor-arkhipov/ico'
const buf = fs.readFileSync('icon.ico')
const ico = Ico.from(buf)
console.log(ico.fileHeader) // IcoFileHeader { reserved: 0, type: 1, count: 7 }
console.log(ico.infoHeaders[0]) // IcoInfoHeader { width: 16, height: 16, ... }
import fs from 'fs'
import { Ico, IcoImage } from '@igor-arkhipov/ico'
const ico = new Ico()
let buf
buf = fs.readFileSync('128x128.png')
image = IcoImage.fromPNG(buf)
ico.append(image)
buf = fs.readFileSync('256x256.png')
image = IcoImage.fromPNG(buf)
ico.append(image)
/* Some other PNG files */
fs.writeFileSync('icon.ico', ico.data)
Create ICO from the icon buffer.