node-upload-images
v1.0.1
Published
Library for uploading images to popular image hosting services, uses Node and Axios.
Downloads
5,719
Maintainers
Readme
node-upload-images
Library for uploading images to popular image hosting services, uses Node and Axios.
- Upload from binary, file and remote URL
Supported services
- new.fastpic.org
- pixhost.to
- postimages.org
- upload.cc - DDoS Guard protection bypassed using axios-ddos-guard-bypass
Installation
npm install node-upload-images
Usage
Upload from binary data:
import { ImageUploadService } from 'node-upload-images';
import * as fs from 'fs';
const service = new ImageUploadService('new.fastpic.org');
try {
const imageData = fs.readFileSync('/test.png');
let { directLink } = await service.uploadFromBinary(imageData, 'test.png');
console.log(directLink);
} catch (error) {}
Upload from file:
import { ImageUploadService } from 'node-upload-images';
const service = new ImageUploadService('new.fastpic.org');
try {
let { directLink } = await service.uploadFromUrl('./test.png');
console.log(directLink);
} catch (error) {}
Upload from remote URL:
import { ImageUploadService } from 'node-upload-images';
const service = new ImageUploadService('new.fastpic.org');
try {
let { directLink } = await service.uploadFromUrl(
'https://example.com/image.png'
);
console.log(directLink);
} catch (error) {}
Limitations
No login/authentication support yet, image upload is anonymous.