diff --git a/src/util.ts b/src/util.ts index c73a84f..11e467e 100644 --- a/src/util.ts +++ b/src/util.ts @@ -92,17 +92,6 @@ export function align(i: number, align: number) { return o ? align - o + i : i; } -/** - * Get ArrayBuffer from Buffer. - * - * @param buffer Buffer instance. - * @returns ArrayBuffer copy. - */ -export function bufferToArrayBuffer(buffer: Readonly) { - const {byteOffset, byteLength} = buffer; - return buffer.buffer.slice(byteOffset, byteOffset + byteLength); -} - /** * Get launcher data for an ID. * diff --git a/src/util/windows.ts b/src/util/windows.ts index 23c280c..9201fae 100644 --- a/src/util/windows.ts +++ b/src/util/windows.ts @@ -8,7 +8,7 @@ import { Data } from '@shockpkg/resedit'; -import {align, bufferToArrayBuffer, launcher} from '../util'; +import {align, launcher} from '../util'; // IMAGE_DATA_DIRECTORY indexes. const IDD_RESOURCE = 2; @@ -162,7 +162,7 @@ function exeUpdateSizes(exe: NtExecutable) { * @param iconData Icon data. */ function rsrcPatchIcon(rsrc: NtExecutableResource, iconData: Readonly) { - const ico = Data.IconFile.from(bufferToArrayBuffer(iconData)); + const ico = Data.IconFile.from(iconData); for (const iconGroup of Resource.IconGroupEntry.fromEntries(rsrc.entries)) { Resource.IconGroupEntry.replaceIconsForResource( rsrc.entries,