{"_id":"pe-coff","_rev":"437790","name":"pe-coff","description":"Parse the COFF file header of a PE","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"vweevers","email":""}],"time":{"modified":"2021-08-05T06:22:54.000Z","created":"2016-12-19T23:03:31.239Z","1.0.0":"2016-12-19T23:03:31.239Z"},"users":{},"author":{"name":"Vincent Weevers"},"repository":{"type":"git","url":"git+https://github.com/vweevers/pe-coff.git"},"versions":{"1.0.0":{"name":"pe-coff","version":"1.0.0","description":"Parse the COFF file header of a PE","license":"MIT","author":{"name":"Vincent Weevers"},"files":["index.js"],"scripts":{"test":"node test.js"},"dependencies":{"fs-maybe-open":"~1.0.0","fs-read-exactly":"~1.0.0","pe-machine-type-descriptor":"~1.0.0","pe-signature":"~1.0.0","pe-signature-offset":"~1.0.0"},"devDependencies":{"tape":"~4.6.3"},"repository":{"type":"git","url":"git+https://github.com/vweevers/pe-coff.git"},"bugs":{"url":"https://github.com/vweevers/pe-coff/issues"},"homepage":"https://github.com/vweevers/pe-coff","keywords":["coff","pe","pe-coff","portable-executable","windows"],"engines":{"node":">=4.0.0","npm":">=2.0.0"},"gitHead":"cf934ca4f119eeb0da58674c3e4a641d9473788f","_id":"pe-coff@1.0.0","_shasum":"3f4c409039bf64bd4064cb59824ff1e7927b0d2e","_from":".","_npmVersion":"4.0.3","_nodeVersion":"6.8.0","_npmUser":{"name":"vweevers","email":"dev@vincentweevers.nl"},"maintainers":[{"name":"vweevers","email":""}],"dist":{"shasum":"3f4c409039bf64bd4064cb59824ff1e7927b0d2e","size":3043,"noattachment":false,"key":"/pe-coff/-/pe-coff-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/pe-coff/download/pe-coff-1.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/pe-coff-1.0.0.tgz_1482188610614_0.23328347806818783"},"directories":{},"publish_time":1482188611239,"_cnpm_publish_time":1482188611239,"_hasShrinkwrap":false}},"readme":"# pe-coff\n\n**Parse the COFF file header of a [PE](https://en.wikipedia.org/wiki/Portable_Executable). As specified by [Microsoft PE and COFF Specification 9.3](https://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/pecoff_v83.docx) <sup>[doc]</sup>, section 3.3.**\n\n[![npm status](http://img.shields.io/npm/v/pe-coff.svg?style=flat-square)](https://www.npmjs.org/package/pe-coff) [![node](https://img.shields.io/node/v/pe-coff.svg?style=flat-square)](https://www.npmjs.org/package/pe-coff) [![Travis build status](https://img.shields.io/travis/vweevers/pe-coff.svg?style=flat-square&label=travis)](http://travis-ci.org/vweevers/pe-coff) [![AppVeyor build status](https://img.shields.io/appveyor/ci/vweevers/pe-coff.svg?style=flat-square&label=appveyor)](https://ci.appveyor.com/project/vweevers/pe-coff) [![Dependency status](https://img.shields.io/david/vweevers/pe-coff.svg?style=flat-square)](https://david-dm.org/vweevers/pe-coff)\n\n## example\n\n```js\nconst pecoff = require('pe-coff')\n\npecoff('file.exe', function (err, header, location) {\n  console.log(header)\n  console.log(location)\n})\n```\n\nThe `header` has these properties:\n\n```json\n{\n  \"machineType\": \"i386\",\n  \"machineDescription\": \"Intel 386 or later processors and compatible processors\",\n  \"numberOfSections\": 3,\n  \"timeDateStamp\": 1480757919,\n  \"pointerToSymbolTable\": 0,\n  \"numberOfSymbols\": 0,\n  \"sizeOfOptionalHeader\": 224,\n  \"characteristics\": 258\n}\n```\n\nAnd `location` contains the offset and length of the header in bytes:\n\n```json\n{\n  \"offset\": 132,\n  \"length\": 20\n}\n```\n\n## `pecoff(mixed, [limit], callback)`\n\nWhere `mixed` is either a filename or a file descriptor. Use `limit` (the number of bytes to read) if you only need the first (few) fields:\n\n```js\npecoff('file.exe', pecoff.NUMBER_OF_SECTIONS, function (err, header) {\n  // Will have machineType, machineDescription, numberOfSections\n  console.log(header)\n})\n\npecoff('file.exe', pecoff.MACHINE_TYPE, function (err, header) {\n  // Will have machineType, machineDescription\n  console.log(header)\n})\n```\n\n## related\n\n- [pe-signature](https://github.com/vweevers/pe-signature)\n- [pe-signature-offset](https://github.com/vweevers/pe-signature-offset)\n- [pe-machine-type-descriptor](https://github.com/vweevers/pe-machine-type-descriptor])\n\n## install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install pe-coff\n```\n\n## license\n\n[MIT](http://opensource.org/licenses/MIT) © Vincent Weevers\n","_attachments":{},"homepage":"https://github.com/vweevers/pe-coff","bugs":{"url":"https://github.com/vweevers/pe-coff/issues"},"license":"MIT"}