{"id":24558082,"url":"https://github.com/rse/npm-install-fetch","last_synced_at":"2025-07-27T00:07:27.019Z","repository":{"id":65411477,"uuid":"134180105","full_name":"rse/npm-install-fetch","owner":"rse","description":"Fetch External Resources on NPM Package Installation","archived":false,"fork":false,"pushed_at":"2024-02-10T15:36:04.000Z","size":47,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-19T00:32:55.583Z","etag":null,"topics":["fetch","install","node","npm","script"],"latest_commit_sha":null,"homepage":"http://npmjs.com/npm-install-fetch","language":"JavaScript","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/rse.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-05-20T19:27:26.000Z","updated_at":"2021-12-24T07:01:35.000Z","dependencies_parsed_at":"2024-06-19T10:01:31.521Z","dependency_job_id":null,"html_url":"https://github.com/rse/npm-install-fetch","commit_stats":{"total_commits":112,"total_committers":2,"mean_commits":56.0,"dds":0.008928571428571397,"last_synced_commit":"373c802f4a6ba2ede708db09f9d526721f9ddf66"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/rse/npm-install-fetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fnpm-install-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fnpm-install-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fnpm-install-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fnpm-install-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rse","download_url":"https://codeload.github.com/rse/npm-install-fetch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fnpm-install-fetch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267019469,"owners_count":24022496,"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-07-25T02:00:09.625Z","response_time":70,"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":["fetch","install","node","npm","script"],"created_at":"2025-01-23T05:47:21.074Z","updated_at":"2025-07-27T00:07:26.969Z","avatar_url":"https://github.com/rse.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nnpm-install-fetch\n=================\n\nFetch External Resources on NPM Package Installation\n\n\u003cp/\u003e\n\u003cimg src=\"https://nodei.co/npm/npm-install-fetch.png?downloads=true\u0026stars=true\" alt=\"\"/\u003e\n\n\u003cp/\u003e\n\u003cimg src=\"https://david-dm.org/rse/npm-install-fetch.png\" alt=\"\"/\u003e\n\nAbout\n-----\n\nThis [Node.js](https://nodejs.org) module provides an API and CLI for\nautomatically fetching external resources during the `install` step\nof the Node Package Manager (NPM). It is primarily intended to let\nlarge NPM modules have a small NPM module distribution size, as the NPM\nregistry dislikes too large (more than a few MB) distribution tarballs\n(mainly because it keeps all versions of an NPM module and this way it\nwould get flooded with a massive amount of data).\n\nInstallation\n------------\n\n```shell\n$ npm install npm-install-fetch --save-dev\n```\n\nUsage\n-----\n\nThere are three distinct ways of using it:\n\n1. Command-Line Interface (CLI) with CLI Options:\u003cbr/\u003e\n\n    - Example `package.json` (single resource only):\n\n        ```json\n        {\n            \"dependencies\": {\n                \"npm-install-fetch\": \"latest\"\n            },\n            \"scripts\": {\n                \"install\": \"npm-install-fetch -n \\\"Example 1.2.3\\\" -o example.tgz https://github.com/example/example/archive/1.2.3.tar.gz\"\n            }\n        }\n        ```\n\n    - Supported CLI Options:\n\n        - `-h`, `--help`: show usage help\n        - `-V`, `--version`: show program version information\n        - `-c \u003cfile\u003e`, `--config \u003cfile\u003e`: path to YAML configuration file (default: `\"npm-install-fetch.yaml\"`)\n        - `-a \u003carch\u003e`, `--arch \u003carch\u003e`: ensure system architecture matches (default: `\"*\"`)\n        - `-p \u003cplatform\u003e`, `--platform \u003cplatform\u003e`: ensure system platform matches (default: `\"*\"`)\n        - `-n \u003cname\u003e`, `--name \u003cname\u003e`: name of resource (default: `\"\"`)\n        - `-d`, `--decompress`: decompress input\n        - `-e`, `--extract`: extract archive to individual files\n        - `-s \u003cnumber\u003e`, `--strip \u003cnumber\u003e`: strip top-level directories from extracted files (default: `0`)\n        - `-f \u003cfilter\u003e`, `--filter \u003cfilter\u003e`: filter extracted files(s) (default: none)\n        - `-m \u003cmap-from\u003e:\u003cmap-to\u003e`, `--map \u003cmap-from\u003e:\u003cmap-to\u003e`: map extracted file paths (default: none)\n        - `-o \u003cfile\u003e`, `--output \u003cfile\u003e`: output directory or file (default: `\".\"`)\n\n2. Command-Line Interface (CLI) with NPM Package Configuration Entry:\u003cbr/\u003e\n\n    - Example `package.json` (single resource):\n\n        ```json\n        {\n            \"dependencies\": {\n                \"npm-install-fetch\": \"latest\"\n            },\n            \"scripts\": {\n                \"install\": \"npm-install-fetch\"\n            },\n            \"npm-install-fetch\": {\n                \"name\":    \"Example 1.2.3\",\n                \"input\":   \"https://github.com/example/example/archive/1.2.3.tar.gz\",\n                \"output\":  \"example.tgz\"\n            }\n        }\n        ```\n\n    - Example `package.json` (multiple resources):\n\n        ```json\n        {\n            \"dependencies\": {\n                \"npm-install-fetch\": \"latest\"\n            },\n            \"scripts\": {\n                \"install\": \"npm-install-fetch\"\n            },\n            \"npm-install-fetch\": [ {\n                \"name\":    \"Example1 1.2.3\",\n                \"input\":   \"https://github.com/example1/example1/archive/1.2.3.tar.gz\",\n                \"output\":  \"example1.tgz\"\n            }, {\n                \"name\":    \"Example2 1.2.3\",\n                \"input\":   \"https://github.com/example2/example2/archive/1.2.3.tar.gz\",\n                \"output\":  \"example2.tgz\"\n            } ]\n        }\n        ```\n\n    - Supported Configuration Entries:\n\n        - `arch?: string`: ensure system architecture matches (default: `\"*\"`)\n        - `platform?: string`: ensure system platform matches (default: `\"*\"`)\n        - `name?: string`: name of resource (default: `\"\"`)\n        - `input: string`: URL of resource\n        - `decompress?: boolean`: decompress resource (default: `false`)\n        - `extract?: boolean`: extract archive to individual files (default: `false`)\n        - `strip?: number`: strip top-level directories from extracted files (default: `0`)\n        - `filter?: (string|[string+]|function)`: filter extracted files(s) (default: none)\n        - `map?: ([string,string]|[[string,string]+]|function)`: map extracted file paths (default: none)\n        - `output?: string`: output directory or file (default: `\".\"`)\n\n3. Command-Line Interface (CLI) with YAML Configuration File:\u003cbr/\u003e\n\n    - Example `package.json`:\n\n        ```json\n        {\n            \"dependencies\": {\n                \"npm-install-fetch\": \"latest\"\n            },\n            \"scripts\": {\n                \"install\": \"npm-install-fetch\"\n            }\n        }\n        ```\n\n    - Example `npm-install-fetch.yaml` (single resource):\n\n        ```yaml\n        - name:    Example 1.2.3\n          input:   https://github.com/example/example/archive/1.2.3.tar.gz\n          output:  example.tgz\n        ```\n\n    - Example `npm-install-fetch.yaml` (multiple resources):\n\n        ```yaml\n        - name:    Example1 1.2.3\n          input:   https://github.com/example1/example1/archive/1.2.3.tar.gz\n          output:  example1.tgz\n\n        - name:    Example2 1.2.3\n          input:   https://github.com/example2/example2/archive/1.2.3.tar.gz\n          output:  example2.tgz\n        ```\n\n    - Supported Configuration Entries:\n\n        - `arch?: string`: ensure system architecture matches (default: `\"*\"`)\n        - `platform?: string`: ensure system platform matches (default: `\"*\"`)\n        - `name?: string`: name of resource (default: `\"\"`)\n        - `input: string`: URL of resource\n        - `decompress?: boolean`: decompress resource (default: `false`)\n        - `extract?: boolean`: extract archive to individual files (default: `false`)\n        - `strip?: number`: strip top-level directories from extracted files (default: `0`)\n        - `filter?: (string|[string+]|function)`: filter extracted files(s) (default: none)\n        - `map?: ([string,string]|[[string,string]+]|function)`: map extracted file paths (default: none)\n        - `output?: string`: output directory or file (default: `\".\"`)\n\n4. Application Programming Interface (API):\u003cbr/\u003e\n\n    - Example `package.json`:\n\n        ```json\n        {\n            \"dependencies\": {\n                \"npm-install-fetch\": \"latest\"\n            },\n            \"scripts\": {\n                \"install\": \"node npm-install.js\"\n            }\n        }\n        ```\n\n    - Example `npm-install.js` (single resource):\n\n        ```js\n        const fetch = require(\"npm-install-fetch\")\n\n        fetch({\n            name:    \"Example 1.2.3\",\n            input:   \"https://github.com/example/example/archive/1.2.3.tar.gz\",\n            output:  \"example.tgz\"\n        })\n        ```\n\n    - Example `npm-install.js` (multiple resources):\n\n        ```js\n        const fetch = require(\"npm-install-fetch\")\n\n        fetch([ {\n            name:    \"Example1 1.2.3\",\n            input:   \"https://github.com/example1/example1/archive/1.2.3.tar.gz\",\n            output:  \"example1.tgz\"\n        }, {\n            name:    \"Example2 1.2.3\",\n            input:   \"https://github.com/example2/example2/archive/1.2.3.tar.gz\",\n            output:  \"example2.tgz\"\n        } ])\n        ```\n\n    - Supported Configuration Options:\n\n        - `arch?: string`: ensure system architecture matches (default: `\"*\"`)\n        - `platform?: string`: ensure system platform matches (default: `\"*\"`)\n        - `name?: string`: name of resource (default: `\"\"`)\n        - `input: string`: URL of resource\n        - `decompress?: boolean`: decompress resource (default: `false`)\n        - `extract?: boolean`: extract archive to individual files (default: `false`)\n        - `strip?: number`: strip top-level directories from extracted files (default: `0`)\n        - `filter?: (string|[string+]|function)`: filter extracted files(s) (default: none)\n        - `map?: ([string,string]|[[string,string]+]|function)`: map extracted file paths (default: none)\n        - `output?: string`: output directory or file (default: `\".\"`)\n\nExample 1: Large External Data\n------------------------------\n\nThe module `fasttext-lid` depends on a large 128MB model, available\nfrom Facebook. The `package.json` of module `fasttext-lid` is:\n\n```\n{\n    \"name\":        \"fasttext-lid\",\n    [...]\n    \"dependencies\": {\n        \"npm-install-fetch\":       \"0.9.8\",\n        [...]\n    },\n    \"scripts\": {\n        \"install\":        \"npm-install-fetch\"\n        [...]\n    },\n    \"npm-install-fetch\": {\n        \"name\":    \"FastText LID-176 model\",\n        \"input\":   \"https://s3-us-west-1.amazonaws.com/fasttext-vectors/supervised_models/lid.176.bin\",\n        \"output\":  \"fasttext-lid-model.bin\"\n    }\n}\n```\n\nExample 2: Large Internal Data\n------------------------------\n\nThe module `typopro-web` has large generated fonts in its source-tree under `web/`.\nThe `.npmignore` (for `npm publish`) and `package.json` (for `npm install`) files\nof module `typopro-web` are:\n\n```\n.git\nnode_modules\nweb\n```\n\n```\n{\n    \"name\":        \"typopro-web\",\n    [...]\n    \"dependencies\": {\n        \"npm-install-fetch\":  \"1.0.0\",\n        \"shx\":                \"0.3.0\"\n    },\n    \"scripts\": {\n        \"install\":            \"npm-install-fetch\",\n        \"uninstall\":          \"shx rm -rf web\"\n    },\n    \"npm-install-fetch\": {\n        \"name\":    \"TypoPRO: Fonts for Professional Typography (WEB) 4.0.0\",\n        \"input\":   \"https://github.com/rse/typopro-web/archive/4.0.0.tar.gz\",\n        \"extract\": true,\n        \"strip\":   1,\n        \"filter\":  [ \"web/*\" ],\n        \"output\":  \".\"\n    }\n}\n```\n\nNotice\n------\n\nOptions `strip`, `filter` and `map` require option `extract` to\nbe meaningful. The options are executed in the order `strip`\nfirst, `filter` second and `map` third by the underlying\n[decompress](http://npmjs.com/decompress) module. Keep this order in\nmind, as `filter` sees only already stripped paths and `map` sees only\nalready filtered paths.\n\nLicense\n-------\n\nCopyright \u0026copy; 2018-2024 Dr. Ralf S. Engelschall (http://engelschall.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fnpm-install-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frse%2Fnpm-install-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fnpm-install-fetch/lists"}