{"name":"pe-library","version":"2.0.0","keywords":["javascript","library","pe","pe-executable","portable-executable","exe"],"author":{"name":"jet"},"license":"MIT","_id":"pe-library@2.0.0","maintainers":[{"name":"jet2jet","email":"smalljet@hotmail.co.jp"}],"homepage":"https://github.com/jet2jet/pe-library-js","bugs":{"url":"https://github.com/jet2jet/pe-library-js/issues"},"dist":{"shasum":"0f0c012f0d899f702fbf58d80d06608a56323db8","tarball":"http://registry-npm.ywwl.com/pe-library/download/pe-library-2.0.0.tgz","fileCount":45,"integrity":"sha512-zlJVlneLboInPzJCEt2qrZrM9R90kdkhduR/oupm89ASJ271x45TfdKjSy0b5oPgBCNOmRaquPen8eSHyv7JEA==","signatures":[{"sig":"MEQCIE4kRxR776HjDiMFvDoVgMuKkfxhJAiLGSH2rbP2Efg8AiANuyDetm3/VcyBD+26psv+h9swYVrVQ6VVOH7mli2ISA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/pe-library@2.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":141457,"size":25525,"noattachment":false,"key":"/pe-library/-/pe-library-2.0.0.tgz"},"type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"npm":">=11.5.1","node":">=20.19.5"},"exports":{".":"./dist/index.js","./cjs":{"require":"./cjs.cjs"}},"funding":{"url":"https://github.com/sponsors/jet2jet","type":"github"},"gitHead":"38f54160611020ca2de3a41c93eccd62c6054a35","scripts":{"lint":"npm run lint:eslint && npm run lint:prettier","test":"jest --config ./jest.config.basic.js","build":"npm run build:esm","version":"node ./tools/updateVersion.js ./src/main/version.ts && git add -A ./src/main/version.ts","lint:fix":"npm run lint:eslint:fix && npm run lint:prettier:fix","build:esm":"tsc -p ./tsconfig.app.json","typecheck":"tsc -p tsconfig.json && echo \"Done.\"","lint:eslint":"eslint -c eslint.config.mjs --ext .js,.jsx,.ts,.tsx .","lint:prettier":"prettier --config ./.prettierrc.yml --check \"**/*.{js,jsx,ts,tsx,yml,json,md}\"","lint:eslint:fix":"eslint -c eslint.config.mjs --fix --ext .js,.jsx,.ts,.tsx .","lint:prettier:fix":"prettier --config ./.prettierrc.yml --write \"**/*.{js,jsx,ts,tsx,yml,json,md}\""},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c4718224-861f-4ef6-a0f9-67e6025dd61e"}},"repository":{"url":"git+https://github.com/jet2jet/pe-library-js.git","type":"git"},"_npmVersion":"11.5.1","description":"Node.js library for Portable Executable format","directories":{},"_nodeVersion":"20.19.5","engineStrict":true,"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","eslint":"^9.37.0","ts-jest":"^29.4.5","prettier":"^3.6.2","typescript":"~4.9.5","@types/jest":"^30.0.0","@types/node":"~20.19.22","neostandard":"^0.12.2","eslint-plugin-n":"^17.23.1","eslint-plugin-promise":"^7.2.1","eslint-config-prettier":"^10.1.8","eslint-plugin-import-x":"^4.16.1","@typescript-eslint/parser":"^8.46.1","@typescript-eslint/eslint-plugin":"^8.46.1"},"_npmOperationalInternal":{"tmp":"tmp/pe-library_2.0.0_1760692966647_0.17100540988550295","host":"s3://npm-registry-packages-npm-production"},"readme":"[![NPM version](https://badge.fury.io/js/pe-library.svg)](https://www.npmjs.com/package/pe-library)\n[![Build Status](https://github.com/jet2jet/pe-library-js/actions/workflows/main-ci.yml/badge.svg)](https://github.com/jet2jet/pe-library-js)\n\n# pe-library\n\npe-library provides parsing and generating Portable Executable (known as Windows Executables) binaries.\n\n## Usage\n\n```js\nimport * as PE from 'pe-library';\nimport * as fs from 'fs';\n\n// load and parse data\nlet data = fs.readFileSync('MyApp.exe');\n// (the Node.js Buffer instance can be specified directly to NtExecutable.from)\nlet exe = PE.NtExecutable.from(data);\n\n// get section data\nlet exportSection = exe.getSectionByEntry(PE.Format.ImageDirectoryEntry.Export);\n// read binary data stored in exportSection.data ...\n// to write binary: use exe.setSectionByEntry\n\n// write to buffer\nlet newBin = exe.generate();\nfs.writeFileSync('MyApp_modified.exe', new Buffer(newBin));\n```\n\n### from CommonJS (using `require`)\n\n> Starting from v1.0.0, CommonJS support is changed; you must use `pe-library/cjs` to use from CommonJS file.\n\n```js\nconst { load } = require('pe-library/cjs');\nconst fs = require('fs');\nload().then((PE) => {\n  // load and parse data\n  let data = fs.readFileSync('MyApp.exe');\n  // (the Node.js Buffer instance can be specified directly to NtExecutable.from)\n  let exe = PE.NtExecutable.from(data);\n\n  // get section data\n  let exportSection = exe.getSectionByEntry(\n    PE.Format.ImageDirectoryEntry.Export\n  );\n  // read binary data stored in exportSection.data ...\n  // to write binary: use exe.setSectionByEntry\n\n  // write to buffer\n  let newBin = exe.generate();\n  fs.writeFileSync('MyApp_modified.exe', new Buffer(newBin));\n});\n```\n\n#### for CommonJS-based TypeScript module\n\n```ts\n// you can use PE namespace for type-reference only\nimport { type PE, load } from 'pe-library/cjs';\nload().then((pe: typeof PE) => {\n  ...\n});\n```\n\n## License\n\n- All programs / source codes / binaries in this package, EXCEPT FOLLOWINGS, are licensed with [MIT License](./LICENSE).\n- The followings are licensed with 0-BSD license:\n  - [tools/dos-stub/dos-stub.asm](./tools/dos-stub/dos-stub.asm)\n  - The bit code, generated from tools/dos-stub/dos-stub.asm, written in [src/main/util/generate.ts](./src/main/util/generate.ts) as `DOS_STUB_PROGRAM`\n","publish_time":1760692966821,"_cnpm_publish_time":1760692966821,"dist-tags":{"latest":"2.0.1"}}