{"id":22980879,"url":"https://github.com/screamz/tiles-downloader","last_synced_at":"2025-08-24T17:09:09.292Z","repository":{"id":263286021,"uuid":"889906231","full_name":"ScreamZ/tiles-downloader","owner":"ScreamZ","description":"A small library to download map tiles","archived":false,"fork":false,"pushed_at":"2024-12-05T17:41:04.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T12:34:41.438Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ScreamZ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-11-17T14:45:48.000Z","updated_at":"2024-12-05T17:41:08.000Z","dependencies_parsed_at":"2025-04-02T09:52:10.143Z","dependency_job_id":null,"html_url":"https://github.com/ScreamZ/tiles-downloader","commit_stats":null,"previous_names":["screamz/tiles-downloader"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ScreamZ/tiles-downloader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ScreamZ%2Ftiles-downloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ScreamZ%2Ftiles-downloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ScreamZ%2Ftiles-downloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ScreamZ%2Ftiles-downloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ScreamZ","download_url":"https://codeload.github.com/ScreamZ/tiles-downloader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ScreamZ%2Ftiles-downloader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271910495,"owners_count":24842357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-12-15T01:46:03.737Z","updated_at":"2025-08-24T17:09:09.251Z","avatar_url":"https://github.com/ScreamZ.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tiles downloader\n\n\u003e [!IMPORTANT]\n\u003e This module is ESM only.\n\nThis module allows you to download tiles from a tile server. Therefore you can use it to download tiles from OpenStreetMap, etc. for offline use or caching.\n\n## Installation\n\n```sh\nnpm install @codingspark/tiles-downloader\n```\n\n## Example usage\n\n### Tiles downloading\n\nGeneric tiles download using `fetch` that works in browser and most server environments.\n\n```ts\nimport path from \"node:path\";\nimport { downloadTiles } from \"@codingspark/tiles-downloader\";\n\nawait downloadTiles(\n  {\n    url: \"https://tile.openstreetmap.org/{z}/{x}/{y}.png\",\n    zoomLevels: [14, 15, 16],\n    throttleConfig: { limit: 3, interval: 1000 },\n    bounds: {\n      minLat: 43.5704,\n      maxLat: 43.645,\n      minLon: 3.8095,\n      maxLon: 3.923,\n    },\n  },\n  async ({ x, y, z, buffer }) =\u003e {\n    const outputPath = path.join(\n      \"./map\",\n      z.toString(),\n      x.toString(),\n      `${y}.png`\n    );\n\n    console.log(`Writing tile ${z}/${x}/${y}`);\n\n    // Using bun but use anything you want to write the buffer to a file\n    Bun.write(outputPath, buffer);\n  }\n);\n```\n\n### Generate tiles for a specific area\n\nThis can be useful if you want to only get tiles for a specific need or you want to manage downloading tiles by yourself.\n\n```ts\nimport { computeTiles } from \"@codingspark/tiles-downloader\";\n\nconst tiles = computeTiles({\n  bounds: {\n    minLat: 43.5704,\n    maxLat: 43.645,\n    minLon: 3.8095,\n    maxLon: 3.923,\n  },\n  zoomLevels: [14, 15, 16],\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscreamz%2Ftiles-downloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscreamz%2Ftiles-downloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscreamz%2Ftiles-downloader/lists"}