{"id":28381082,"url":"https://github.com/imgproxy/imgproxy-node","last_synced_at":"2025-06-25T01:31:49.936Z","repository":{"id":206947435,"uuid":"711932677","full_name":"imgproxy/imgproxy-node","owner":"imgproxy","description":"A helper library for more easily constructing imgproxy URLs","archived":false,"fork":false,"pushed_at":"2025-05-20T10:41:23.000Z","size":89,"stargazers_count":26,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-30T03:40:11.819Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/imgproxy.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}},"created_at":"2023-10-30T13:18:17.000Z","updated_at":"2025-05-20T10:41:27.000Z","dependencies_parsed_at":"2025-04-09T23:31:29.840Z","dependency_job_id":null,"html_url":"https://github.com/imgproxy/imgproxy-node","commit_stats":null,"previous_names":["imgproxy/imgproxy-node"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/imgproxy/imgproxy-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgproxy%2Fimgproxy-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgproxy%2Fimgproxy-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgproxy%2Fimgproxy-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgproxy%2Fimgproxy-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imgproxy","download_url":"https://codeload.github.com/imgproxy/imgproxy-node/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgproxy%2Fimgproxy-node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261785220,"owners_count":23209264,"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":"2025-05-30T03:37:56.853Z","updated_at":"2025-06-25T01:31:49.922Z","avatar_url":"https://github.com/imgproxy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://imgproxy.net\"\u003e\n    \u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"assets/logo-dark.svg?sanitize=true\"\u003e\n      \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"assets/logo-light.svg?sanitize=true\"\u003e\n      \u003cimg alt=\"imgproxy logo\" src=\"assets/logo-light.svg?sanitize=true\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cstrong\u003e\n  \u003ca href=\"https://imgproxy.net\"\u003eWebsite\u003c/a\u003e |\n  \u003ca href=\"https://imgproxy.net/blog/\"\u003eBlog\u003c/a\u003e |\n  \u003ca href=\"https://docs.imgproxy.net\"\u003eDocumentation\u003c/a\u003e |\n  \u003ca href=\"https://imgproxy.net/#pro\"\u003eimgproxy Pro\u003c/a\u003e\n\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/imgproxy/imgproxy/pkgs/container/imgproxy\"\u003e\u003cimg alt=\"Docker\" src=\"https://img.shields.io/badge/Docker-0068F1?style=for-the-badge\u0026logo=docker\u0026logoColor=fff\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://bsky.app/profile/imgproxy.net\"\u003e\u003cimg alt=\"Bluesky\" src=\"https://img.shields.io/badge/Bluesky-0068F1?style=for-the-badge\u0026logo=bluesky\u0026logoColor=fff\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://x.com/imgproxy_net\"\u003e\u003cimg alt=\"X\" src=\"https://img.shields.io/badge/X.com-0068F1?style=for-the-badge\u0026logo=x\u0026logoColor=fff\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://mastodon.social/@imgproxy\"\u003e\u003cimg alt=\"X\" src=\"https://img.shields.io/badge/Mastodon-0068F1?style=for-the-badge\u0026logo=mastodon\u0026logoColor=fff\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://discord.gg/5GgpXgtC9u\"\u003e\u003cimg alt=\"Discord\" src=\"https://img.shields.io/badge/Discord-0068F1?style=for-the-badge\u0026logo=discord\u0026logoColor=fff\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/imgproxy/imgproxy/actions\"\u003e\u003cimg alt=\"GH Test\" src=\"https://img.shields.io/github/actions/workflow/status/imgproxy/imgproxy-node/ci.yml?branch=main\u0026label=CI\u0026style=for-the-badge\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nThis library helps make image processing with imgproxy easier.\n\n**[imgproxy](https://github.com/imgproxy/imgproxy)** is a fast and secure standalone server for resizing and converting remote images. The main principles of imgproxy are simplicity, speed, and security — it’s a Go application, ready to be installed and used in any Unix environment, and also ready to be containerized using Docker.\n\nimgproxy-node helps build your own image processing pipeline and create URLs for imgproxy requests. You no longer need to remember all the secret key names: the library will automatically use your ENV variables and provide a generated link to the processed image as output.\n\nSee image processing on the fly with imgproxy-node in this [demo](https://react-server-components-demo.vercel.app/image/1?preset=format_webp).\n\n\u003cp\u003e\u003ca href=\"https://evilmartians.com/?utm_source=imgproxy-node\"\u003e\n  \u003cpicture\u003e\n    \u003csource\n      media=\"(prefers-color-scheme: dark)\"\n      srcset=\"https://evilmartians.com/badges/sponsored-by-evil-martians_v2.0_for-dark-bg@2x.png\"\n    \u003e\n    \u003cimg\n      src=\"https://evilmartians.com/badges/sponsored-by-evil-martians_v2.0@2x.png\"\n      alt=\"Sponsored by Evil Martians\"\n      width=\"236\"\n      height=\"54\"\n    \u003e\n  \u003c/picture\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n- [Install](#install)\n- [Usage](#usage)\n- [Methods](#methods)\n\n## Install\n\n```bash\nnpm install @imgproxy/imgproxy-node\n```\n\n## Usage\n\n```js\nimport { generateImageUrl } from '@imgproxy/imgproxy-node';\n\nconst url = generateImageUrl({\n  endpoint: \"https://imgproxy.example.com/\",\n  url: \"https://example.com/image.jpg\",\n  options: {\n    resizing_type: \"fit\",\n    width: 300,\n    gravity: { type: \"no\" },\n    enlarge: 1,\n  },\n  salt: \"520f986b998545b4785e0defbc4f3c1203f22de2374a3d53cb7a7fe9fea309c5\",\n  key: \"943b421c9eb07c830af81030552c86009268de4e532ba2ee2eab8247c6da0881\",\n});\n```\n\n## Methods\n\n### generateImageUrl\n\nThis method generates an imgproxy URL.\nIt takes the following arguments:\n\n- `endpoint` (`string`) - (required) the base URL of your imgproxy instance\n- `url` (`Object | string`) - (required) a string with url value or an object that contains the value and displayAs properties. You can specify only url if you agree with default `url.displayAs` = \"base64\" or you have to specify `url.value` and `url.displayAs`.\n  - `value` (`string`) - (required) the plain text URL of the image.\n  - `displayAs` (`\"base64\" | \"encrypted\" | \"plain\"`) - (optional) how the image URL should be presented in the resulting imgproxy request URL. Deafult value is `\"base64\"`.\n    Can be one of the following:\n    - `\"base64\"` - a base64 encoded URL. Default value.\n    - `\"encrypted\"` - (**PRO feature**) an AES-CBC encrypted URL.\n    - `\"plain\"` - a plain text URL. We strongly recommend using `base64` or `encrypted` type.\n- `options` (`Object | undefined`) - (optional) an object that contains the resizing options. You can see all options in [imgproxy docs](https://docs.imgproxy.net/generating_the_url?id=processing-options) or in [Options types in imgproxy-js-core library](https://github.com/imgproxy/imgproxy-js-core/blob/main/src/types/index.ts).\n- `salt` (`string | undefined`) - (optional) hex-encoded salt used to encode the URL. It must be a hex-encoded 16-byte string. This option overrides IMGPROXY_SALT environment variable from process.env for this call.\n- `key` (`string | undefined`) - (optional) hex-encoded key used to encode the URL. It must be a hex-encoded 16-byte string. This option overrides IMGPROXY_KEY environment variable from process.env for this call.\n- `encryptKey` (`string | undefined`) - (optional, **PRO feature**) hex-encoded key used to encrypt the URL. The key should be either 16, 24, or 32 bytes long for AES-128-CBC, AES-192-CBC, or AES-256-CBC, respectively. This option overrides IMGPROXY_SOURCE_URL_ENCRYPTION_KEY environment variable from process.env for this call.\n- `encryptIV` (`string | undefined`) - (optional, **PRO feature**) hex-encoded 16-bytes length IV for encrypting url. If not specified, the IV will be generated randomly. But it's better if you specify it yourself. Read more in [imgproxy docs iv-generation](https://docs.imgproxy.net/usage/encrypting_source_url#iv-generation).\n\n### generateImageInfoUrl\n\nThis method generates an imgproxy URL to get a source image info.\nIt takes the following arguments:\n\n- `endpoint` (`string`) - (required) the base URL of your imgproxy instance\n- `url` (`Object | string`) - (required) a string with url value or an object that contains the value and displayAs properties. You can specify only url if you agree with default `url.displayAs` = \"base64\" or you will have to specify `url.value` and `url.displayAs`.\n  - `value` (`string`) - (required) the plain text URL of the image.\n  - `displayAs` (`\"base64\" | \"encrypted\" | \"plain\"`) - (optional) how the image URL should be presented in the resulting imgproxy request URL. Deafult value is `\"base64\"`.\n    Can be one of the following:\n    - `\"base64\"` - a base64 encoded URL. Default value.\n    - `\"encrypted\"` - (**PRO feature**) an AES-CBC encrypted URL.\n    - `\"plain\"` - a plain text URL. We strongly recommend using `base64` or `encrypted` type.\n- `options` (`Object | undefined`) - (optional) an object that contains the resizing options. You can see all options in [imgproxy docs](https://docs.imgproxy.net/getting_the_image_info?id=info-options) or in [OptionsImageInfo types in imgproxy-js-core library](https://github.com/imgproxy/imgproxy-js-core/blob/main/src/types/index.ts).\n- `salt` (`string | undefined`) - (optional) hex-encoded salt used to encode the URL. It must be a hex-encoded 16-byte string. This option overrides IMGPROXY_SALT from process.env for one request.\n- `key` (`string | undefined`) - (optional) hex-encoded key used to encode the URL. It must be a hex-encoded 16-byte string. This option overrides IMGPROXY_KEY from process.env for one request.\n- `encryptKey` (`string | undefined`) - (optional, **PRO feature**) hex-encoded key used to encrypt the URL. The key should be either 16, 24, or 32 bytes long for AES-128-CBC, AES-192-CBC, or AES-256-CBC, respectively. This option overrides IMGPROXY_SOURCE_URL_ENCRYPTION_KEY from process.env for one request.\n- `encryptIV` (`string | undefined`) - (optional, **PRO feature**) hex-encoded 16-bytes length IV for encrypting url. If not specified, the IV will be generated randomly. But it's better if you specify it yourself. Read more in [imgproxy docs iv-generation](https://docs.imgproxy.net/usage/encrypting_source_url#iv-generation).\n\n\n# Development\n\nThe project uses [changesets](https://github.com/changesets/changesets) to manage versioning and changelog.\nTypical workflow is as follows:\n1. make changes to codebase,\n2. run `npm run changesets` at project root and follow prompt to generate a \"changeset\" (logging a change),\n3. commit both (1) and (2) into git.\n\nThe [changesets Github action](./.github/workflows/publish.yml) is triggered on `push` to `main` and will create a corresponding \"Changesets: Versioning \u0026 Publication\" pull request, which, upon merged, will trigger publication of the new version to NPM.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimgproxy%2Fimgproxy-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimgproxy%2Fimgproxy-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimgproxy%2Fimgproxy-node/lists"}