{"_id":"get-uri@8.0.2","bugs":{"url":"https://github.com/TooTallNate/proxy-agents/issues"},"dist":{"shasum":"eee9dd30c4e02fbe28c418cbd21abf80fbed6da3","tarball":"http://registry-npm.ywwl.com/get-uri/download/get-uri-8.0.2.tgz","fileCount":39,"integrity":"sha512-H1sU7ppM+Hdb+FJgOTaQ7SHiV7ogUgnb+VgZ55Dz3YzLqZ4bMAClcdveHYt56npM9M7eclEg1j92ZnmSOP9uhA==","signatures":[{"sig":"MEQCIDcYlPLEr2jRJ2YjHwWlhhxRDNC2NGJfa9HZRgyjNlzQAiBqaMNI98de8myeM7DsaqB1g3kRpakaJnp/VF3sQ6TrZg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCID0H1h4mq2FJrFVz93Luox/Rp21G/SxqUUBzkqVbY5PcAiBrt+0yuM1YvF8FwFVrxJAN5UVScV0f1VLP71e0qCYWhQ=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/get-uri@8.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":44722,"size":13833,"noattachment":false,"key":"/get-uri/-/get-uri-8.0.2.tgz"},"name":"get-uri","type":"module","_from":"file:get-uri-8.0.2.tgz","author":{"url":"http://n8.io/","name":"Nathan Rajlich","email":"nathan@tootallnate.net"},"engines":{"node":">= 20"},"exports":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"license":"MIT","scripts":{"lint":"eslint . --ext .ts","pack":"node ../../scripts/pack.mjs","test":"vitest","build":"tsc"},"version":"8.0.2","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"161f169d-7deb-4a01-b2c4-3efe441e06ad"}},"homepage":"https://github.com/TooTallNate/proxy-agents#readme","keywords":["uri","read","readstream","stream","get","http","https","ftp","file","data","protocol","url"],"_resolved":"/tmp/06f6f05d6f197c8f4e947e309c0672a2/get-uri-8.0.2.tgz","_integrity":"sha512-H1sU7ppM+Hdb+FJgOTaQ7SHiV7ogUgnb+VgZ55Dz3YzLqZ4bMAClcdveHYt56npM9M7eclEg1j92ZnmSOP9uhA==","repository":{"url":"git+https://github.com/TooTallNate/proxy-agents.git","type":"git","directory":"packages/get-uri"},"_npmVersion":"12.2.2","description":"Returns a `stream.Readable` from a URI string","directories":{},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"_nodeVersion":"24.22.2","dependencies":{"debug":"^4.3.4","basic-ftp":"^6.2.4","data-uri-to-buffer":"8.0.0"},"_hasShrinkwrap":false,"devDependencies":{"st":"^3.0.0","ftpd":"^0.2.14","tsconfig":"0.0.0","typescript":"^5.1.6","@types/ftpd":"^0.2.35","@types/node":"^22.13.0","@types/debug":"^4.1.7","async-listen":"^3.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/get-uri_8.0.2_1794854183133_0.2979331786629119"},"readme":"get-uri\n=======\n### Returns a `stream.Readable` from a URI string\n\nThis high-level module accepts a URI string and returns a `Readable` stream\ninstance. There is built-in support for a variety of \"protocols\", and it's\neasily extensible with more:\n\n| Protocol  | Description                     | Example\n|:---------:|:-------------------------------:|:---------------------------------:\n| `data`    | [Data URIs][data]               | `data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D`\n| `file`    | [File URIs][file]               | `file:///c:/windows/example.ini`\n| `ftp`     | [FTP URIs][ftp]                 | `ftp://ftp.kernel.org/pub/site/README`\n| `http`    | [HTTP URIs][http]               | `http://www.example.com/path/to/name`\n| `https`   | [HTTPS URIs][https]             | `https://www.example.com/path/to/name`\n\nExample\n-------\n\nTo simply get a `stream.Readable` instance from a `file:` URI, try something like:\n\n```ts\nimport { getUri } from 'get-uri';\n\n// `file:` maps to a `fs.ReadStream` instance…\nconst stream = await getUri('file:///Users/nrajlich/wat.json');\nstream.pipe(process.stdout);\n```\n\n\nMissing Endpoints\n-----------------\n\nWhen you pass in a URI in which the resource referenced does not exist on the\ndestination server, then a `NotFoundError` will be thrown. The `code` of the\nerror instance is set to `\"ENOTFOUND\"`, so you can check for that value\nto detect when a bad filename is requested:\n\n```ts\ntry {\n  await getUri('http://example.com/resource.json');\n} catch (err) {\n  if (err.code === 'ENOTFOUND') {\n    // bad file path requested\n  } else {\n    // something else bad happened...\n    throw err;\n  }\n}\n```\n\n\nCacheability\n------------\n\nWhen calling `getUri()` with the same URI multiple times, the `get-uri` module\nsupports sending an indicator that the remote resource has not been modified\nsince the last time it has been retrieved from that node process.\n\nTo do this, define a `cache` property on the \"options object\" argument\nwith the value set to the `stream.Readable` instance that was previously\nreturned. If the remote resource has not been changed since the last call for\nthat same URI, then a `NotModifiedError` instance will be thrown with its\n`code` property set to `\"ENOTMODIFIED\"`.\n\nWhen the `\"ENOTMODIFIED\"` error occurs, then you can safely re-use the\nresults from the previous `getUri()` call for that same URI:\n\n``` js\n// First time fetches for real\nconst stream = await getUri('http://example.com/resource.json');\n\ntry {\n  // … some time later, if you need to get this same URI again, pass in the\n  // previous `stream.Readable` instance as `cache` option to potentially\n  // have an \"ENOTMODIFIED\" error thrown:\n  await getUri('http://example.com/resource.json', { cache: stream });\n} catch (err) {\n  if (err.code === 'ENOTMODIFIED') {\n    // source file has not been modified since last time it was requested,\n    // so you are expected to re-use results from a previous call to `getUri()`\n  } else {\n    // something else bad happened...\n    throw err;\n  }\n}\n```\n\n\nAPI\n---\n\n### getUri(uri: string | URL, options?: Object]): Promise<Readable>\n\nA `uri` is required. An optional `options` object may be passed in:\n\n - `cache` - A `stream.Readable` instance from a previous call to `getUri()` with the same URI. If this option is passed in, and the destination endpoint has not been modified, then an `ENOTMODIFIED` error is thrown\n\nAny other options passed in to the `options` object will be passed through\nto the low-level connection creation functions (`http.get()`, `ftp.connect()`,\netc).\n\nReturns a `stream.Readable` instance to read the resource at the given `uri`.\n\n[data]: http://tools.ietf.org/html/rfc2397\n[file]: http://tools.ietf.org/html/draft-hoffman-file-uri-03\n[ftp]: http://www.w3.org/Protocols/rfc959/\n[http]: http://www.w3.org/Protocols/rfc2616/rfc2616.html\n[https]: http://wikipedia.org/wiki/HTTP_Secure\n","publish_time":1794854183226,"_cnpm_publish_time":1794854183226,"dist-tags":{"latest":"8.0.2"}}