imgbb-uploader
Advanced tools
Comparing version 1.0.3 to 1.1.0
{ | ||
"name": "imgbb-uploader", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Lightweight module to upload images through Imgbb API.", | ||
"main": "index.js", | ||
"main": "lib/cjs/index.js", | ||
"browser": "lib/cjs/index.js", | ||
"module": "lib/esm/index.js", | ||
"types": "lib/index.d.ts", | ||
"dependencies": { | ||
"fs": "0.0.1-security", | ||
"request": "^2.88.0" | ||
"fs": "0.0.1-security" | ||
}, | ||
"devDependencies": {}, | ||
"scripts": { | ||
"test": "npx standard" | ||
"test": "jest --config jestconfig.json", | ||
"build": "node rebuild.js && tsc -p tsconfig-cjs.json", | ||
"build:cjs": "node rebuild.js && tsc -p tsconfig-cjs.json", | ||
"build:esm": "node rebuild.js && tsc -p tsconfig.json", | ||
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"", | ||
"lint": "tslint -p tsconfig.json", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm test && npm run lint", | ||
"preversion": "npm run lint", | ||
"version": "npm run format && git add -A src", | ||
"postversion": "git push && git push --tags", | ||
"pretty-quick": "pretty-quick" | ||
}, | ||
"files": [ | ||
"lib/**/*" | ||
], | ||
"devDependencies": { | ||
"@babel/types": "^7.11.0", | ||
"@types/dotenv": "^8.2.0", | ||
"@types/jest": "^26.0.9", | ||
"@types/node": "^14.0.27", | ||
"dotenv": "^8.2.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"husky": "^4.2.5", | ||
"jest": "^26.4.0", | ||
"prettier": "^2.0.5", | ||
"pretty-quick": "^2.0.1", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^26.2.0", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^3.9.7" | ||
}, | ||
"repository": { | ||
@@ -20,3 +52,5 @@ "type": "git", | ||
"imgbb", | ||
"imgbb-uploader" | ||
"imgbb-uploader", | ||
"image upload", | ||
"picture upload" | ||
], | ||
@@ -28,3 +62,8 @@ "author": "TheRealBarenziah", | ||
}, | ||
"homepage": "https://github.com/TheRealBarenziah/imgbb-uploader#readme" | ||
"homepage": "https://github.com/TheRealBarenziah/imgbb-uploader#readme", | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "pretty-quick --staged" | ||
} | ||
} | ||
} |
# imgbb-uploader | ||
Lightweight Nodejs module to upload local pictures files to imgbb API and get display URLs in response. | ||
Lightweight Nodejs module to upload local pictures files to imgbb API and get display URLs in response. | ||
Primary use is letting imgBB handle the hosting & serving of images. | ||
[![https://nodei.co/npm/imgbb-uploader.png?downloads=true&downloadRank=true&stars=true](https://nodei.co/npm/imgbb-uploader.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/imgbb-uploader) | ||
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/TheRealBarenziah/imgbb-uploader/badge.svg?targetFile=package.json)](https://snyk.io/test/github/TheRealBarenziah/imgbb-uploader?targetFile=package.json) | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
[![Build Status](https://travis-ci.org/TheRealBarenziah/imgbb-uploader.svg?branch=master)](https://travis-ci.org/TheRealBarenziah/imgbb-uploader) | ||
## Compatibility: | ||
## Compatibility: | ||
**Node >= 8** ( [this module uses async/await](https://node.green/) ) | ||
*Care: this module uses `fs` under the hood. It means it WON'T work outside the node environment !* | ||
*To upload pictures from your frontend please check the [File API](https://developer.mozilla.org/en-US/docs/Web/API/File) instead* | ||
_Care: this module uses `fs` under the hood. It means **it WON'T work outside the node environment !**_ | ||
_To upload pictures from your frontend please check the [File API](https://developer.mozilla.org/en-US/docs/Web/API/File) instead_ | ||
## Install | ||
`npm install imgbb-uploader` | ||
## Use | ||
- I) [Get a free API key from imgbb](https://api.imgbb.com/) ( estimated time : ~1 minute ) | ||
- I) [Get a free API key from imgbb](https://api.imgbb.com/) ( estimated time ~1 minute ) | ||
- II) (facultative) [Put that in an environment variable](https://www.npmjs.com/package/dotenv) | ||
- III) **imgbbUploader takes *exactly two* String arguments** : your API key, and the absolute path of your image : | ||
- III) **imgbbUploader takes _exactly two_ String arguments** : your API key, and the absolute path of your image : | ||
@@ -30,2 +36,3 @@ ``` | ||
## `.then(response => console.log(response))` output example : | ||
``` | ||
@@ -63,8 +70,11 @@ { | ||
**This module is ~20 lines long & totally unlicensed: to better fit your need, feel free to edit !** | ||
**This module is tiny & totally unlicensed: to better fit your need, feel free to fork !** | ||
[Basic instructions for tweaking](https://github.com/TheRealBarenziah/imgbb-uploader/blob/master/CONTRIBUTING.md) | ||
## Learn more | ||
This module doesn't support array uploads. For heavy duty, you'll probably have to work with [fs.readdir](https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback) and [async forEach](https://www.npmjs.com/package/async-foreach) (you may also be interested in [path](https://nodejs.org/api/path.html#path_path) ). | ||
This module doesn't support array uploads. For heavy duty, you'll probably have to work with [fs.readdir](https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback) and [async forEach](https://www.npmjs.com/package/async-foreach) (you may also be interested in [path](https://nodejs.org/api/path.html#path_path) ). | ||
For example, you can create a `baseDir.js` file wherever it suits you: | ||
``` | ||
@@ -76,7 +86,6 @@ // baseDir.js | ||
``` | ||
Then you can require this file elsewhere and use something like `path.join(myDirpath, "subfolder", subsubfolder)` to dig into directories programmatically. Once there, you can f.e. `fs.readdir` and iterate `forEach` file of that directory. | ||
See `fs` documentation and Stack Overflow for more inspiration on the matter. | ||
See `fs` documentation and Stack Overflow for more inspiration on the matter. | ||
## Changelog | ||
0.2.1 => 1.0.0 (Replace `var` and `function` with proper ES6 syntax & update README) | ||
1.0.0 => 1.0.1 (Fix README) | ||
[CHANGELOG](https://github.com/TheRealBarenziah/imgbb-uploader/blob/master/CHANGELOG.md) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
16506
1
11
100
209
89
15
2
- Removedrequest@^2.88.0
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.10.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)