{"_id":"@astropub/vite-plugin-file","_rev":"2-23f4c5243da6cdd6c05d002231e35da5","name":"@astropub/vite-plugin-file","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@astropub/vite-plugin-file","version":"0.1.0","keywords":["vite","vite-plugin","file","file-stream","file-metadata","blob","file-api","readable-stream","arraybuffer","file-access","webapi","modern-web","frontend","web-development"],"license":"MIT-0","_id":"@astropub/vite-plugin-file@0.1.0","maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"dist":{"shasum":"1fa0ec602983156d834f18d02e56e7d6524e2d26","tarball":"https://registry.npmjs.org/@astropub/vite-plugin-file/-/vite-plugin-file-0.1.0.tgz","fileCount":5,"integrity":"sha512-6JAwjQgcPlxy3GV5bQw4DFRYmSDtpQwew6Mn9uoSuo1wOBOJ/eDTmbdMt+nnS1YTOaexvkoTMMoo66uycFTmHg==","signatures":[{"sig":"MEQCIAh2uJPsQh9gS8n6VhtkpNeBWeZDab00kbM9INSZdAnvAiA8pSn6OiRo/wI70pKDQpeHaPWx6wXsXWNpB9ZP+gC28g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10016},"type":"module","$schema":"https://json.schemastore.org/package.json","exports":{".":{"types":"./vite-plugin-file.d.ts","import":"./vite-plugin-file.js"}},"gitHead":"2aca715adc11d2a9494fdc85481398328c133127","_npmUser":{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},"_npmVersion":"10.7.0","description":"A Vite plugin for seamless access to file metadata and data streams, supporting modern Web API interfaces like Blob, File, and ArrayBuffer","directories":{},"_nodeVersion":"22.1.0","_hasShrinkwrap":false,"devDependencies":{"vite":"^6.0.2"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-file_0.1.0_1733242543919_0.44527634097366375","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"@astropub/vite-plugin-file","version":"0.2.0","keywords":["vite","vite-plugin","file","file-stream","file-metadata","blob","file-api","readable-stream","arraybuffer","file-access","webapi","modern-web","frontend","web-development"],"license":"MIT-0","_id":"@astropub/vite-plugin-file@0.2.0","maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"dist":{"shasum":"998d9024ce87030658238e125ba12cc90a1bea37","tarball":"https://registry.npmjs.org/@astropub/vite-plugin-file/-/vite-plugin-file-0.2.0.tgz","fileCount":5,"integrity":"sha512-5zpASVlxH6WzPHwksuQS+lIsU3U0D0y5VLHMO1DGvnsM9MgrLzHrzwj1Foh4loeENsBiUZcz79dzkoYVnEwX5A==","signatures":[{"sig":"MEQCIF3XDhtUi8fAb/FuvdR2yJ2fa5YnoS2mlcNrkyh0j2m1AiBp2Rrfwm84InAH/+v6iIXeb5q2CJZUejVMgV0ouoK7Lw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10060},"type":"module","$schema":"https://json.schemastore.org/package.json","exports":{".":{"types":"./vite-plugin-file.d.ts","import":"./vite-plugin-file.js"}},"gitHead":"2c30941406c3bef360129c1faa81e11f20bf48d5","_npmUser":{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},"_npmVersion":"10.7.0","description":"A Vite plugin for seamless access to file metadata and data streams, supporting modern Web API interfaces like Blob, File, and ArrayBuffer","directories":{},"_nodeVersion":"22.1.0","_hasShrinkwrap":false,"devDependencies":{"vite":"^6.0.2"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-file_0.2.0_1734007881672_0.09923736727219978","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"$schema":"https://json.schemastore.org/package.json","name":"@astropub/vite-plugin-file","description":"A Vite plugin for seamless access to file metadata and data streams, supporting modern Web API interfaces like Blob, File, and ArrayBuffer","version":"0.2.1","type":"module","license":"MIT-0","exports":{".":{"import":"./vite-plugin-file.js","types":"./vite-plugin-file.d.ts"}},"devDependencies":{"vite":"^6.0.2"},"keywords":["vite","vite-plugin","file","file-stream","file-metadata","blob","file-api","readable-stream","arraybuffer","file-access","webapi","modern-web","frontend","web-development"],"_id":"@astropub/vite-plugin-file@0.2.1","gitHead":"57ac265a5fbc12ff38e1a19f0cdbaac4ad0d25ef","_nodeVersion":"22.1.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-g8jKMxGW/LQza28paltDXRbt/Chu6WCOQojyjIwCC6qvnlLpMx33a0MtXbQihy9YLhnYr35PjNA80W3cKnhEjA==","shasum":"4e0253ce4e1579919da1a3e8f325161444cb959f","tarball":"https://registry.npmjs.org/@astropub/vite-plugin-file/-/vite-plugin-file-0.2.1.tgz","fileCount":5,"unpackedSize":10187,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDFNbps6H+3ZKpr/EFNvuKaHwhwVyuGcW+ANRAQ9SXpAIhAI+Hv6tpnjnhGOuBGYA3ePBptVwPkh1Ry1mMmLsuhk4F"}]},"_npmUser":{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},"directories":{},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-plugin-file_0.2.1_1734008821231_0.4326294075465906"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-03T16:15:43.825Z","modified":"2024-12-12T13:07:01.640Z","0.1.0":"2024-12-03T16:15:44.117Z","0.2.0":"2024-12-12T12:51:21.855Z","0.2.1":"2024-12-12T13:07:01.421Z"},"license":"MIT-0","keywords":["vite","vite-plugin","file","file-stream","file-metadata","blob","file-api","readable-stream","arraybuffer","file-access","webapi","modern-web","frontend","web-development"],"description":"A Vite plugin for seamless access to file metadata and data streams, supporting modern Web API interfaces like Blob, File, and ArrayBuffer","maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"readme":"# Vite-Plugin-File <img src=\"https://jonneal.dev/vite-logo.svg\" alt=\"\" width=\"90\" height=\"90\" align=\"right\">\n\n**vite-plugin-file** enables seamless access to file information and data in **[Vite](https://vite.dev)** projects.\n\n[![NPM Version][npm-img]][npm-url]\n[![NPM Downloads][dl-img]][dl-url]\n\n- **Efficient File Handling**: Stream large files without consuming excess memory.\n- **Convenient File Formats**: Work seamlessly with modern Web APIs.\n  - Work with large files efficiently via `ReadableStream`.\n  - Access the entire file as `ArrayBuffer`, `Blob`, or `File`.\n- **Simple Metadata Access**: Retrieve critical file information with minimal effort.\n  - Retrieve file name, type, size, and last modified time.\n  - Access metadata as HTTP-style headers and preconfigured responses.\n- **Vite Integration**: Built specifically for Vite, ensuring seamless integration.\n  - Includes automatic TypeScript typings for `?file` imports.\n\n## Installation\n\nInstall the plugin:\n\n```shell\nnpm install @astropub/vite-plugin-file\n```\n\nAdd the plugin to your Vite configuration file:\n\n```js\n// vite.config.js\nimport vitePluginFile from \"@astropub/vite-plugin-file\"\n\nexport default {\n  plugins: [vitePluginFile()]\n}\n```\n\n## Usage\n\nAdd the `?file` suffix to any file import to access its metadata and contents.\n\n```js\nimport FaviconIco from \"./assets/favicon.ico?file\"\n```\n\n#### File Metadata\n\nRetrieve basic metadata about any file.\n\n```js\nimport FaviconIco from \"./assets/favicon.ico?file\"\n\nconsole.log(FaviconIco.name)         // \"favicon.ico\"\nconsole.log(FaviconIco.type)         // \"image/x-icon\"\nconsole.log(FaviconIco.size)         // 9608\nconsole.log(FaviconIco.lastModified) // 1735689600000\n```\n\n#### File Stream\n\nStream any file efficiently without loading it into memory.\n\n```js\nimport FaviconIco from \"./assets/favicon.ico?file\"\n\nconst stream = FaviconIco.stream() // ReadableStream\n\nconst response = FaviconIco.response() // Response (with pre-configured headers)\n```\n\n#### Full File Access\n\nAccess the file as `ArrayBuffer`, `Blob`, or `File`.\n\n```js\nimport FaviconIco from \"./assets/favicon.ico?file\"\n\nconst buffer = await FaviconIco.arrayBuffer()\nconsole.log(buffer.byteLength) // 9608\n\nconst blob = await FaviconIco.blob()\nconsole.log(blob.type)         // \"image/x-icon\"\n\nconst file = await FaviconIco.file()\nconsole.log(file.name)         // \"favicon.ico\"\nconsole.log(file.lastModified) // 1735689600000\n```\n\n#### File Metadata as Headers\n\nRetrieve the file metadata as HTTP-style headers.\n\n```js\nimport FaviconIco from \"./assets/favicon.ico?file\"\n\nconst headers = FaviconIco.headers()\nconsole.log(headers.get(\"content-type\"))   // \"image/x-icon\"\nconsole.log(headers.get(\"content-length\")) // \"9608\"\nconsole.log(headers.get(\"last-modified\"))  // \"Wed, 01 Jan 2025 00:00:00 GMT\"\n```\n\n## License\n\nLicensed under the [MIT-0 License](https://opensource.org/license/mit-0).\n\n<br />\n\nEnjoy!\n\n[npm-img]: https://img.shields.io/npm/v/@astropub/vite-plugin-file?color=%23444&label=&labelColor=%23CB0000&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjE1MCAxNTAgNDAwIDQwMCIgZmlsbD0iI0ZGRiI+PHBhdGggZD0iTTE1MCA1NTBoMjAwVjI1MGgxMDB2MzAwaDEwMFYxNTBIMTUweiIvPjwvc3ZnPg==&style=for-the-badge\n[npm-url]: https://www.npmjs.com/package/@astropub/vite-plugin-file\n[dl-url]: https://www.npmjs.com/package/@astropub/vite-plugin-file\n[dl-img]: https://img.shields.io/badge/dynamic/json?url=https://api.npmjs.org/downloads/point/last-week/@astropub/vite-plugin-file&query=downloads&label=⇓+week&color=%23444&labelColor=%23EEd100&style=for-the-badge\n","readmeFilename":"README.md"}