{"id":15434148,"url":"https://github.com/franckldx/swapi-stream","last_synced_at":"2025-04-04T16:41:39.341Z","repository":{"id":74441949,"uuid":"73611421","full_name":"franckLdx/swapi-stream","owner":"franckLdx","description":"Download data from https://swapi.co/ using a read stream.","archived":false,"fork":false,"pushed_at":"2018-07-24T21:07:46.000Z","size":94,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T07:07:30.449Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/franckLdx.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-11-13T11:26:53.000Z","updated_at":"2021-02-13T10:57:45.000Z","dependencies_parsed_at":"2023-05-06T15:47:57.013Z","dependency_job_id":null,"html_url":"https://github.com/franckLdx/swapi-stream","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"ca19113a3464a1cb88fe84e22f847b4876a29b28"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franckLdx%2Fswapi-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franckLdx%2Fswapi-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franckLdx%2Fswapi-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franckLdx%2Fswapi-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franckLdx","download_url":"https://codeload.github.com/franckLdx/swapi-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247214145,"owners_count":20902728,"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","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-10-01T18:37:27.498Z","updated_at":"2025-04-04T16:41:39.313Z","avatar_url":"https://github.com/franckLdx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swapi-stream\n\nDownload [swapi data](https://swapi.co/) using a read stream.\n\n## Requirement\n* Node \u003e= 8.0.0 (swapi-stream 1.x works with node 6.0.0)\n* To be fan of Star Wars\n\n## Installation\nnpm install --save swapi-stream\n\n## Usage\nTo get films list:\n```javascript\nconst swapiStream = require('swapi-stream');\nconst result = swapiStream.get(swapiStream.FILMS);\nresult.on('data', data =\u003e console.log(data.title));\nresult.on('error', (error) =\u003e console.log('ERROR', error.toString()));\nresult.on('end', () =\u003e console.log('END'));\n```\nTo get planets list:\n```javascript\nconst swapiStream = require('swapi-stream');\nconst result = swapiStream.get(swapiStream.PLANETS);\nresult.on('data', data =\u003e console.log(data.title));\nresult.on('error', (error) =\u003e console.log('ERROR', error.toString()));\nresult.on('end', () =\u003e console.log('END'));\n```\n\n## API\n```javascript\nconst myStream = swapiStream.get(\u003cresourceName\u003e);\n```\n__resourceName__ is mandatory. It's the resource name as defined [swapi data Rest API](https://swapi.co/documentation#root). Rather than typing the name, you can use swapiStream constants (like shown in above examples):\n* FILMS\n* PEOPLE\n* PLANETS\n* VEHICLES\n* STARSHIPS\n* SPECIES\n\n__swapiStream.get__ returns a stream emitting the regular events data, end and error. As it's a stream, it returns all entities of the resource. If this does not suit your need, you may prefer a module that returns entities page by page like [swapi-node](https://www.npmjs.com/package/swapi-node).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranckldx%2Fswapi-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranckldx%2Fswapi-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranckldx%2Fswapi-stream/lists"}