{"_id":"@bun-win32/wininet","_rev":"4-649923cf032ff42233dec2d64e79693b","name":"@bun-win32/wininet","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/wininet","version":"1.0.0","keywords":["bun","ffi","win32","windows","wininet","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/wininet@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"f5cb745e21fbad1a2d3de8ea81188ff411c46b3c","tarball":"https://registry.npmjs.org/@bun-win32/wininet/-/wininet-1.0.0.tgz","fileCount":6,"integrity":"sha512-roFtZwph9k7hHpRQU/WDQJx8slqG15oYelqgyVl0GJHI0gOkaKhvzKjtLJktGIkPpXGfxbUDNydKUXChXCfSUg==","signatures":[{"sig":"MEUCIQD11aLMohU4PrRKJofOIe0qgBeBw0IgBeFT2nfFAk7VGQIgGWYgXr00usj48hI5E2RbpsqjcgTIsbIFWPgOsT0cqXE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":107666},"main":"./index.ts","type":"module","module":"index.ts","shasum":"f5cb745e21fbad1a2d3de8ea81188ff411c46b3c","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:cache-heatmap":"bun ./example/cache-heatmap.ts","example:http-inspector":"bun ./example/http-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-roFtZwph9k7hHpRQU/WDQJx8slqG15oYelqgyVl0GJHI0gOkaKhvzKjtLJktGIkPpXGfxbUDNydKUXChXCfSUg==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/wininet"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 WININET bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/wininet_1.0.0_1778847656127_0.743408835757736","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/wininet","version":"1.0.1","keywords":["bun","ffi","win32","windows","wininet","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/wininet@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"3891adcdef2ea561c589a251a22d91d77cd6f99e","tarball":"https://registry.npmjs.org/@bun-win32/wininet/-/wininet-1.0.1.tgz","fileCount":6,"integrity":"sha512-rs0I2KsahgpuAmi1/sA2sxcwzqDgj5ckzTS+vZsVa+CZ3CTQfpuI6x+z219YxLWI9QvEYNSBRRBR9cx3NuM/AQ==","signatures":[{"sig":"MEYCIQDgcIAmL6hFfMMH7IV7CI2lBkHDl14t+5KrEPC/zTuaKAIhAMH3cEuVgBrtj4J+zagE/0WKDhVdWHgTpIHgx9PvEHfV","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":107692},"main":"./index.ts","type":"module","module":"index.ts","shasum":"3891adcdef2ea561c589a251a22d91d77cd6f99e","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:cache-heatmap":"bun ./example/cache-heatmap.ts","example:http-inspector":"bun ./example/http-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-rs0I2KsahgpuAmi1/sA2sxcwzqDgj5ckzTS+vZsVa+CZ3CTQfpuI6x+z219YxLWI9QvEYNSBRRBR9cx3NuM/AQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/wininet"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 WININET bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/wininet_1.0.1_1780581930330_0.9793207772372028","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/wininet","version":"2.0.0","keywords":["bun","ffi","win32","windows","wininet","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/wininet@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"98b9f2f43260f77c31c51e453cfb9eebb6dc12ee","tarball":"https://registry.npmjs.org/@bun-win32/wininet/-/wininet-2.0.0.tgz","fileCount":6,"integrity":"sha512-qfJRmRZ7yXBA1loIuOG1g6t3HzbiWlyrD0FqpyCbGETQXBu4mwyx7Bcg6AEfUlsCwJeabAxCd206pUjFeQq8tA==","signatures":[{"sig":"MEUCIQDrNh6oFoGBRGNyo7z66hH8FOP3LTDygmrBCkz0SqW8jQIgddVAnFlO6Vr4VrmHXkb+r/yeP1lMn1CqfzJR9/ZTXeQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":111293},"main":"./index.ts","type":"module","module":"index.ts","shasum":"98b9f2f43260f77c31c51e453cfb9eebb6dc12ee","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:cache-heatmap":"bun ./example/cache-heatmap.ts","example:http-inspector":"bun ./example/http-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-qfJRmRZ7yXBA1loIuOG1g6t3HzbiWlyrD0FqpyCbGETQXBu4mwyx7Bcg6AEfUlsCwJeabAxCd206pUjFeQq8tA==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/wininet"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 WININET bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/wininet_2.0.0_1782435993214_0.3904472124048659","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 WININET bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/wininet","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/wininet"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","wininet","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:cache-heatmap":"bun ./example/cache-heatmap.ts","example:http-inspector":"bun ./example/http-inspector.ts"},"_id":"@bun-win32/wininet@2.0.1","_integrity":"sha512-Gq17zg1SZs1uA6QaQIL1DYv6sqzElgzZ/vZvC/SjX15yucyx+kt6i51zcUIXweK/7eaCarqhMIQcYxpoW+/9tw==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"b0d7bd5fac06964801bf37a844afae860a644411","dist":{"integrity":"sha512-Gq17zg1SZs1uA6QaQIL1DYv6sqzElgzZ/vZvC/SjX15yucyx+kt6i51zcUIXweK/7eaCarqhMIQcYxpoW+/9tw==","shasum":"b0d7bd5fac06964801bf37a844afae860a644411","tarball":"https://registry.npmjs.org/@bun-win32/wininet/-/wininet-2.0.1.tgz","fileCount":6,"unpackedSize":111293,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDwJM566opnR+jX4NMEWT6w43FWX9Ofo/cJ2QNUDr2kIAIgaz7ooZgJ73Heb9uCBVYRw7xxtEUsxRaiFp9fQlYNLRs="}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wininet_2.0.1_1782438218625_0.33817697752743525"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-15T12:20:56.001Z","modified":"2026-06-26T01:43:38.891Z","1.0.0":"2026-05-15T12:20:56.273Z","1.0.1":"2026-06-04T14:05:30.479Z","2.0.0":"2026-06-26T01:06:33.374Z","2.0.1":"2026-06-26T01:43:38.771Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","wininet","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/wininet"},"description":"Zero-dependency, zero-overhead Win32 WININET bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/wininet\n\nZero-dependency, zero-overhead Win32 WinINet bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/wininet` exposes the `wininet.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Wininet`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\nWinINet predates and is distinct from WinHTTP. It is the Internet stack Internet Explorer and the legacy Edge engine were built on. It still exposes things `winhttp` does not: **FTP**, the **persistent URL cache** (`CommitUrlCacheEntry*`, `FindFirstUrlCacheEntry*`), the **IE/Edge-legacy cookie jar** (`InternetGetCookie*`, `InternetSetCookieEx2`), and IE-style **per-site cookie decisions**.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `wininet.dll` — HTTP/HTTPS client, FTP client, persistent URL cache, cookie jar, autodial, proxy/auto-detect, and IE-compatible session options.\n- In-source docs in `structs/Wininet.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Wininet.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/Wininet.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/wininet\n```\n\n## Quick Start\n\n```ts\nimport Wininet, { InternetOpenType, InternetService, InternetFlag, HttpQuery } from '@bun-win32/wininet';\n\nWininet.Preload(['InternetOpenW', 'InternetConnectW', 'HttpOpenRequestW', 'HttpSendRequestW', 'HttpQueryInfoW', 'InternetReadFile', 'InternetCloseHandle']);\n\nconst agent = Buffer.from('bun-win32/1.0\\0', 'utf16le');\nconst hSession = Wininet.InternetOpenW(agent.ptr!, InternetOpenType.PRECONFIG, null, null, 0);\n\nconst host = Buffer.from('learn.microsoft.com\\0', 'utf16le');\nconst hConnect = Wininet.InternetConnectW(hSession, host.ptr!, 443, null, null, InternetService.HTTP, 0, 0n);\n\nconst verb = Buffer.from('GET\\0', 'utf16le');\nconst path = Buffer.from('/en-us/windows/win32/wininet/about-wininet\\0', 'utf16le');\nconst hRequest = Wininet.HttpOpenRequestW(hConnect, verb.ptr!, path.ptr!, null, null, null, InternetFlag.SECURE, 0n);\n\nWininet.HttpSendRequestW(hRequest, null, 0, null, 0);\n\n// Read the HTTP status code as a number.\nconst statusBuf = Buffer.alloc(4);\nconst lenBuf = Buffer.alloc(4);\nlenBuf.writeUInt32LE(4, 0);\nWininet.HttpQueryInfoW(hRequest, HttpQuery.STATUS_CODE | HttpQuery.FLAG_NUMBER, statusBuf.ptr!, lenBuf.ptr!, null);\nconsole.log('Status:', statusBuf.readUInt32LE(0));\n\nWininet.InternetCloseHandle(hRequest);\nWininet.InternetCloseHandle(hConnect);\nWininet.InternetCloseHandle(hSession);\n```\n\n> [!NOTE]\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example:cache-heatmap\nbun run example:http-inspector\n```\n\n## Notes\n\n- Either rely on lazy binding or call `Wininet.Preload()`.\n- Windows only. Bun runtime required.\n- Handles returned by `InternetOpenW`, `InternetConnectW`, `HttpOpenRequestW`, `FtpOpenFileW`, and the cache enumerators are `HINTERNET` / `HANDLE` (`bigint`). Always close them with `InternetCloseHandle` (for HINTERNET) or `FindCloseUrlCache` (for URL-cache enumerators).\n- Strings are UTF-16LE (`LPCWSTR`); allocate with `Buffer.from('...\\0', 'utf16le')` and pass `.ptr`.\n- `InternetSetStatusCallback` requires a `JSCallback` whose pointer remains live for the lifetime of the handle. Free it only after `InternetCloseHandle` returns.\n- The URL cache APIs operate on the Windows-wide WinINet/IE legacy cache (`%LOCALAPPDATA%\\Microsoft\\Windows\\INetCache`). Modern Chromium-based Edge does not write to it.\n- `CommitUrlCacheEntry*` takes `FILETIME` by value; use the `packFILETIME(low, high)` helper from `types/Wininet.ts`.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}