Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zzarcon/save-image
Save remote images locally with ease 🌈💾
https://github.com/zzarcon/save-image
image-processing puppeteer remote save scraping utility
Last synced: 27 days ago
JSON representation
Save remote images locally with ease 🌈💾
- Host: GitHub
- URL: https://github.com/zzarcon/save-image
- Owner: zzarcon
- License: mit
- Created: 2017-08-30T04:56:34.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-15T08:19:05.000Z (about 7 years ago)
- Last Synced: 2024-09-28T14:03:52.411Z (about 1 month ago)
- Topics: image-processing, puppeteer, remote, save, scraping, utility
- Language: JavaScript
- Homepage:
- Size: 48.8 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# save-image [![Build Status](https://travis-ci.org/zzarcon/save-image.svg)](https://travis-ci.org/zzarcon/save-image) 🌈💾
> Save remote images locally with ease**Save image** is a dependency free + promise oriented + image saver utility that makes saving remote images locally trivial.
# Default
Saves an image in the current directory using the remote image name. In this case will output `./avatar.jpeg`
```javascript
import saveImage from 'save-image';const imageUrl = 'http://zzarcon.github.io/static/images/avatar.jpeg';
const image = await saveImage(imageUrl);console.log(image.path);
console.log(image.content);
```# Specify location
```javascript
import saveImage from 'save-image';const imageUrl = 'http://zzarcon.github.io/static/images/avatar.jpeg';
saveImage(imageUrl, './public/download.jpeg');
```# Return type
```typescript
interface Image {
path: string;
content: string;
}
```**path**: Absolute location where the image was saved
**content**: Binary content of the image
# Installation
```
$ yarn add save-image
```# TODO
- [ ] Allow to preserve image extension `saveImage(imageUrl, './public/download')` => `./public/download.jpeg`