{"id":26422345,"url":"https://github.com/jollytoad/deno_import_content","last_synced_at":"2026-03-05T07:35:44.646Z","repository":{"id":60847636,"uuid":"546004844","full_name":"jollytoad/deno_import_content","owner":"jollytoad","description":"Import arbitrary file content in Deno using module resolution algorithms","archived":false,"fork":false,"pushed_at":"2025-11-17T10:46:39.000Z","size":39,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-17T12:21:51.418Z","etag":null,"topics":["deno","import","typescript"],"latest_commit_sha":null,"homepage":"https://jsr.io/@jollytoad/import-content","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jollytoad.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-10-05T11:02:14.000Z","updated_at":"2025-11-17T10:46:42.000Z","dependencies_parsed_at":"2024-06-27T19:07:15.833Z","dependency_job_id":"12d37e13-d638-45e3-a1b0-ae9dc3e008c2","html_url":"https://github.com/jollytoad/deno_import_content","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"fedb2ec3434a115893e3f1ec0bc24bdaa793c46a"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jollytoad/deno_import_content","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jollytoad%2Fdeno_import_content","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jollytoad%2Fdeno_import_content/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jollytoad%2Fdeno_import_content/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jollytoad%2Fdeno_import_content/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jollytoad","download_url":"https://codeload.github.com/jollytoad/deno_import_content/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jollytoad%2Fdeno_import_content/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30114316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:40:26.266Z","status":"ssl_error","status_checked_at":"2026-03-05T03:39:15.902Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","import","typescript"],"created_at":"2025-03-18T02:03:54.888Z","updated_at":"2026-03-05T07:35:44.623Z","avatar_url":"https://github.com/jollytoad.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deno Import Content\n\nImport arbitrary file content in Deno using module resolution algorithms.\n\nThis includes resolving via an import map, authentication using\n`DENO_AUTH_TOKENS`, and use of the Deno cache.\n\nThe idea is that `importText()`/`importBlob()`/`importBinary()` should act as\nsimilar to dynamic `import()` as possible, but just returning the raw text or\nbinary content instead of an evaluated JS or TS module.\n\nUnfortunately it's not possible for these functions to resolve a relative\nspecifier against the calling module, so they will need to be pre-resolved using\n`import.meta.resolve()`. (See the example below, and the tests)\n\nIf anyone knows how we could get around this, please raise an issue or better\nstill, a PR.\n\n## Permissions\n\nThis module makes use of [`@deno/cache-dir`](https://jsr.io/@deno/cache-dir) to\nperform fetching, and therefore requires all permissions that it requires.\n\nAlthough, `--allow-write` permission for the cache dir is optional. If it is\ngranted, then remote content will be cached, otherwise it will be fetched every\ntime if the content isn't already present in the cache.\n\n## Example\n\n```ts\nimport { importText } from \"jsr:@jollytoad/import-content\";\n\n// Fetch the text content of a remote file\nconst remoteReadme = await importText(\n  \"https://deno.land/x/import_content/README.md\",\n);\n\n// Fetch the text content of a local file\nconst localReadme = await importText(import.meta.resolve(\"./README.md\"));\n\n// Fetch the text content of a file, relying on an import map to resolve to a valid URL\nconst mappedReadme = await importText(\"bare/README.md\");\n```\n\n## Planned Obsolescence\n\nHopefully this entire package will become completely obsolete once Deno fully\nsupports importing of arbitrary files via import attributes...\n\n```ts\nconst remoteReadme = await import(\n  \"https://deno.land/x/import_content/README.md\",\n  { with: { type: \"text\" } }\n);\n\nconst localReadme = await import(\"./README.md\", { with: { type: \"text\" } });\n\nconst mappedReadme = await import(\"bare/README.md\", { with: { type: \"text\" } });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjollytoad%2Fdeno_import_content","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjollytoad%2Fdeno_import_content","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjollytoad%2Fdeno_import_content/lists"}