Registry / http-networking / node-upload-images

node-upload-images

JSON →
library1.0.1jsnpmunverified

node-upload-images is a lightweight Node.js library designed for uploading images to various popular free image hosting services, including new.fastpic.org, pixhost.to, postimages.org, and upload.cc. The library leverages Axios for HTTP requests and provides built-in support for TypeScript, making it suitable for modern JavaScript and TypeScript projects. It currently stands at version 1.0.1, with releases appearing to be infrequent since its initial launch. A notable feature is its ability to bypass DDoS protection for upload.cc using the `axios-ddos-guard-bypass` package. It supports uploading images from binary data, local file paths, or remote URLs. A key limitation is the absence of authentication support; all uploads are anonymous. This makes it ideal for public, unauthenticated image sharing use cases rather than private storage.

npm install node-upload-images
INSTALL
IMPORT
SIG · NODE-UPLOAD-IMAGES
N
node-upload-images
http-networkingjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ImageUploadService
import { ImageUploadService } from 'node-upload-images';
const { ImageUploadService } = require('node-upload-images');
The library primarily uses ES Modules. While CommonJS `require` might work with transpilation or specific Node.js `--experimental-modules` flags, `import` is the intended and officially supported syntax.
ImageHostingService
import { ImageHostingService } from 'node-upload-images';
This is a type definition for the supported service strings (e.g., 'new.fastpic.org'). Useful for type-checking when specifying a host.

Demonstrates uploading an image using all three supported methods: from a local file, from binary data, and from a remote URL. It also shows how to set up the `ImageUploadService`.

import { ImageUploadService } from 'node-upload-images'; import * as fs from 'fs'; import * as path from 'path'; async function uploadExample() { const service = new ImageUploadService('postimages.org'); // Create a dummy image file for demonstration const dummyImagePath = path.join(process.cwd(), 'temp_test_image.png'); const dummyImageData = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=', 'base64'); fs.writeFileSync(dummyImagePath, dummyImageData); try { console.log('Attempting to upload from file...'); let { directLink: fileLink } = await service.uploadFromFile(dummyImagePath); console.log(`Uploaded from file: ${fileLink}`); console.log('Attempting to upload from binary data...'); let { directLink: binaryLink } = await service.uploadFromBinary(dummyImageData, 'binary_test.png'); console.log(`Uploaded from binary: ${binaryLink}`); console.log('Attempting to upload from remote URL (using a placeholder image)...'); let { directLink: urlLink } = await service.uploadFromUrl('https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png'); console.log(`Uploaded from URL: ${urlLink}`); } catch (error) { console.error('Upload failed:', error.message); } finally { // Clean up the dummy file if (fs.existsSync(dummyImagePath)) { fs.unlinkSync(dummyImagePath); console.log('Cleaned up dummy image file.'); } } } uploadExample();
Debug
Known issues
gotchaThe library explicitly states 'No login/authentication support yet, image upload is anonymous.' Developers should be aware that uploaded images are public and cannot be managed or deleted via the library after upload.
fix
For private or managed image storage, consider alternative solutions or use this library only for temporary, public-facing content.
affects: >=1.0.0
gotchaThe stability and availability of free image hosting services can vary significantly. Services might change their APIs, impose new restrictions, or shut down, potentially breaking uploads.
fix
Implement robust error handling around upload calls and consider monitoring the upstream services for changes. For critical applications, self-hosting or paid services are more reliable.
affects: >=1.0.0
gotchaThe library relies on `axios-ddos-guard-bypass` for `upload.cc`. While effective at the time of development, DDoS protection mechanisms evolve. There's a risk that `upload.cc` (or similar services in the future) might update their protection, rendering the bypass ineffective.
fix
Monitor `upload.cc` functionality periodically if you heavily depend on it. Be prepared for potential upload failures and consider reporting issues to the library maintainers or using alternative hosts.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Unsupported image hosting service
An invalid or unsupported string was passed as the `host` parameter to the `ImageUploadService` constructor.
fix
Ensure the `host` string exactly matches one of the supported services (e.g., 'new.fastpic.org', 'pixhost.to', 'postimages.org', 'upload.cc').
TypeError: ImageUploadService is not a constructor
Attempting to use `require()` to import `ImageUploadService` in a CommonJS context when the library is primarily designed for ES Modules.
fix
Use ES Module `import` syntax: `import { ImageUploadService } from 'node-upload-images';` and ensure your Node.js environment or build setup supports ES Modules (e.g., by setting `"type": "module"` in `package.json` or using a bundler like Webpack/Rollup).
Error: ENOENT: no such file or directory, open './test.png'
The file path provided to `uploadFromFile` is incorrect, or the file does not exist at the specified location relative to the current working directory.
fix
Double-check the file path. Use absolute paths (`path.resolve(__dirname, 'test.png')`) or ensure the relative path is correct from where your script is executed.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
axiosrequiredCore HTTP client for making image upload requests to hosting services.
axios-ddos-guard-bypassrequiredSpecifically used to circumvent DDoS protection on services like upload.cc, enhancing reliability.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
node-upload-images — npm install node-upload-images · libregistry