{"id":13674653,"url":"https://github.com/kaimallea/node-imgur","last_synced_at":"2025-12-30T03:38:17.133Z","repository":{"id":45232316,"uuid":"2050723","full_name":"kaimallea/node-imgur","owner":"kaimallea","description":"Upload images to imgur.com","archived":true,"fork":false,"pushed_at":"2021-12-29T17:21:56.000Z","size":2625,"stargazers_count":176,"open_issues_count":0,"forks_count":52,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-14T10:39:18.486Z","etag":null,"topics":["images","imgur"],"latest_commit_sha":null,"homepage":"","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/kaimallea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-07-15T00:58:58.000Z","updated_at":"2025-03-27T21:49:49.000Z","dependencies_parsed_at":"2022-08-29T16:40:16.588Z","dependency_job_id":null,"html_url":"https://github.com/kaimallea/node-imgur","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaimallea%2Fnode-imgur","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaimallea%2Fnode-imgur/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaimallea%2Fnode-imgur/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaimallea%2Fnode-imgur/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaimallea","download_url":"https://codeload.github.com/kaimallea/node-imgur/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250779200,"owners_count":21485891,"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":["images","imgur"],"created_at":"2024-08-02T11:00:56.174Z","updated_at":"2025-12-18T06:39:49.549Z","avatar_url":"https://github.com/kaimallea.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"## 🚨 This repo is no longer maintained. @KenEucker has graciously offered to continue development on his fork at https://github.com/KenEucker/imgur\n## ➡️ It will continue to be published to npm under the `imgur` package name.\n\n---\n\n## Command-line Usage\n\n### Installation\n\n```bash\nnpm install imgur -g\n```\n\n### Usage\n\nPass binary image files, urls, and/or [base64-encoded](http://en.wikipedia.org/wiki/Base64) image strings as arguments. Globbing is supported.\n\nUpload a single image:\n\n```bash\nimgur cat.png\n```\n\nUpload multiple images ([globbing](\u003chttp://en.wikipedia.org/wiki/Glob_(programming)\u003e) supported):\n\n```bash\nimgur cat.png cats.gif cats23.jpg\n\nimgur ~/*.(jpg|png|gif)\n\nimgur ~/Pictures/kittens/*.jpg ~/gifs/sfw/*.gif\n```\n\nUpload an image from another place on the web. Be sure to include http(s):\n\n```bash\nimgur --url https://octodex.github.com/images/topguntocat.png\n```\n\nUpload a Base-64 encoded image:\n\n```bash\nimgur --base64 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAmUlEQVQ4je2TsQ3CMBBFnxMa08WR2IQKJskIUNwMZAcYwWIQMs65JCUpEEIYW4pJy6v+6e6+/hVnnGsAzsCBMi7AsbbW/rIMsAU2xrnmkeruuzW7zgIw+JGbv6fGQpWzfy3HOsJlDQY/AlCv3jpF9oS5ZBOICKoB1YCIlCdQDR9127qyBHP5Gyw3CBXPr/qi709JHXE1S995AsqoJu8x78GsAAAAAElFTkSuQmCC\n```\n\nSaving a client id for subsequent use:\n\n```bash\nimgur --save f9ae01148b53261\n```\n\nDisplay saved client id:\n\n```bash\nimgur --show\n```\n\nRemove previously saved client id:\n\n```bash\nimgur --clear\n```\n\nUse a specific client id one time only (overrides saved id):\n\n```bash\nimgur --client-id f9ae01148b53261 --file ~/me.jpg\n\n# Short-hand\nimgur -c f9ae01148b53261 -f ~/me.jpg\n```\n\nAdd images to an existing album by specifying an album ID:\n\n```bash\nimgur --album-id F8KTV --file ~/me.jpg\n\n# Short-hand\nimgur -a F8KTV ~/me.jpg\n```\n\nYou must own the album. If it's an anonymous album you need to use the `deletehash` in place of the album ID.\n\n## Module Usage\n\n### Installation\n\n```bash\nnpm install imgur\n```\n\n### Usage\n\n#### Requiring the module:\n\n```javascript\nconst imgur = require('imgur');\n```\n\n#### Dealing with client IDs:\n\n```javascript\n// Change this cliend id to your own.\nconst clientId = 'aCs53GSs4tga0ikp';\n\n// Setting\nimgur.setClientId(clientId);\n\n// Getting\nimgur.getClientId();\n\n// You can specify path or keep it null. Defaults to ~/.imgur\nconst path = null;\n\n// Saving to disk. Returns a promise.\nimgur\n  .saveClientId(clientId, path)\n  .then(() =\u003e {\n    console.log('Saved.');\n  })\n  .catch((err) =\u003e {\n    console.log(err.message);\n  });\n\n// Loading from disk\nimgur.loadClientId(path).then(imgur.setClientId);\n```\n\n#### Dealing with API URL:\n\nIn order to change the API Url say Mashape URL, use setAPIUrl(MashapeURL)\n\n```javascript\n//Setting\nimgur.setAPIUrl('https://api.imgur.com/3/');\n\n//If setAPIUrl() is not called, API URL is read from process.env.IMGUR_API_URL\n\n//Getting\nimgur.getAPIUrl();\n```\n\n#### Dealing with Mashape Key\n\nRequests to the Mashape URL expects a X-Mashape-Key: MashapeKey header.\nSet Mashape Key by using setMashapeKey(MashapeKey) method.\nNote: Defaults to process.env.IMGUR_MASHAPE_KEY\n\n```javascript\n//Setting\nimgur.setMashapeKey(https://imgur-apiv3.p.mashape.com/);\n\n//Getting\nimgur.getMashapeKey()\n```\n\n#### Dealing with credentials:\n\nFor when you want to upload images to an account.\n\n```javascript\n// Setting\nimgur.setCredentials('email@domain.com', 'password', 'aCs53GSs4tga0ikp');\n```\n\n#### Uploading files; globbing supported:\n\n```javascript\n// A single image\nimgur\n  .uploadFile('/home/kai/kittens.png')\n  .then((json) =\u003e {\n    console.log(json.link);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n\n// All jpegs in a specific folder\n// to an album you own\nconst albumId = 'F8KTV';\nimgur\n  .uploadFile('/home/kai/*.jpg', albumId)\n  .then((json) =\u003e {\n    console.log(json.link);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n\n// Multiple image types from home folder\nimgur\n  .uploadFile('~/*.(jpg|png|gif)')\n  .then((json) =\u003e {\n    console.log(json.link);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n```\n\n#### Searching images within the gallery:\n\nThe first argument should be a query to search and it's the only required option. The second argument is optional params to sort your query by.\n\n- `sort` - Accepts 'time', 'viral', or 'top' as a value. Defaults to top.\n- `dateRange` - Accepts 'day', 'week', 'month', 'year', or 'all' as a value. Defaults to all.\n- `page` - Accepts an integer (e.g. 1, 2, 3, 4) as a value. Defaults to 1.\n\nSearch returns an object with the query response as an array of objects that include an image's ID, title, description, views, etc.. and the params you sent with the request.\n\n```javascript\nconst query = 'cats';\nconst optionalParams = { sort: 'top', dateRange: 'week', page: 1 };\nimgur\n  .search(query, optionalParams)\n  .then((json) =\u003e {\n    console.log(json);\n  })\n  .catch((err) =\u003e {\n    console.error(err);\n  });\n```\n\n#### Fetching image data:\n\n```javascript\nconst kittenPic = 'mbgq7nd';\nimgur\n  .getInfo(kittenPic)\n  .then((json) =\u003e {\n    console.log(json);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n```\n\n#### Fetching album data:\n\n```javascript\nconst kittenAlbum = 'mbgq7nd';\nimgur\n  .getAlbumInfo(kittenAlbum)\n  .then((json) =\u003e {\n    console.log(json);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n```\n\n#### Creating an album:\n\n```javascript\nimgur\n  .createAlbum()\n  .then((json) =\u003e {\n    console.log(json);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n```\n\n#### Uploading URLs of images hosted elsewhere:\n\n```javascript\n// Include http(s) when specifying URLs\nimgur\n  .uploadUrl('https://octodex.github.com/images/topguntocat.png')\n  .then((json) =\u003e {\n    console.log(json.link);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n```\n\n#### Uploading Base-64 encoded images:\n\n```javascript\nconst imgurFavicon =\n  'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAmUlEQVQ4je2TsQ3CMBBFnxMa08WR2IQKJskIUNwMZAcYwWIQMs65JCUpEEIYW4pJy6v+6e6+/hVnnGsAzsCBMi7AsbbW/rIMsAU2xrnmkeruuzW7zgIw+JGbv6fGQpWzfy3HOsJlDQY/AlCv3jpF9oS5ZBOICKoB1YCIlCdQDR9127qyBHP5Gyw3CBXPr/qi709JHXE1S995AsqoJu8x78GsAAAAAElFTkSuQmCC';\n\nimgur\n  .uploadBase64(imgurFavicon)\n  .then((json) =\u003e {\n    console.log(json.link);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n```\n\n#### Uploading multiple images:\n\nUpload an array of images of the desired upload type ('File', 'Url', 'Base64').\n\nReturns an array of images (imgur image data).\n\n```javascript\nimgur\n  .uploadImages(images, uploadType /*, albumId */)\n  .then((images) =\u003e {\n    console.log(images);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n```\n\n#### Uploading an album:\n\nCreate a new album and upload an array of images of the desired upload type to it ('File', 'Url', 'Base64').\n\nReturns an object with the album data and an array of images { data: {...}, images: [{...}, ...]}.\n\nThe third parameter is an optional fail safe, meaning if the array of images is empty or invalid, it will not fail, but returns an object with empty data and empty images.\n\n```javascript\nimgur\n  .uploadAlbum(images, uploadType /*, failSafe */)\n  .then((album) =\u003e {\n    console.log(album.data, album.images);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n```\n\n#### Deleting anonymous uploads\n\nDelete an image based on the deletehash(generated during the image upload)\n\n```javascript\nimgur\n  .deleteImage(deletehash)\n  .then((status) =\u003e {\n    console.log(status);\n  })\n  .catch((err) =\u003e {\n    console.error(err.message);\n  });\n```\n\n## License\n\n#### MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaimallea%2Fnode-imgur","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaimallea%2Fnode-imgur","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaimallea%2Fnode-imgur/lists"}