(bytes, offset)
| 3107 | * @param {number} offset |
| 3108 | */ |
| 3109 | export function extractICO(bytes, offset) { |
| 3110 | const stream = new Stream(bytes.slice(offset)); |
| 3111 | |
| 3112 | // Move to number of files there are. |
| 3113 | stream.moveTo(4); |
| 3114 | |
| 3115 | // Read the number of files stored in the ICO |
| 3116 | const numberFiles = stream.readInt(2, "le"); |
| 3117 | |
| 3118 | // Move forward to the last file header. |
| 3119 | stream.moveForwardsBy(8 + ((numberFiles-1) * 16)); |
| 3120 | const fileSize = stream.readInt(4, "le"); |
| 3121 | const fileOffset = stream.readInt(4, "le"); |
| 3122 | |
| 3123 | // Move to the end of the last file. |
| 3124 | stream.moveTo(fileOffset + fileSize); |
| 3125 | return stream.carve(); |
| 3126 | } |
| 3127 | |
| 3128 | |
| 3129 | /** |
nothing calls this directly
no test coverage detected