image-download
Download an image from the given URL
Last updated 2 months ago by the-pat .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install image-download 
SYNC missed versions from official npm registry.

image-download

Build Status

Download an image from the given URL.

Install

npm install --save image-download

Usage

const fs = require('fs');
const imageDownload = require('image-download');
const imageType = require('image-type');

imageDownload('https://www.fillmurray.com/g/200/300').then(buffer => {
    const type = imageType(buffer);

    fs.writeFile('bill-murray.' + type.ext, buffer, (err) => console.log(err ? err : 'done!'));
});

API

imageDownload(url)

Returns a Promise. The fulfilled value is a Buffer of the image.

Or null if the URL is bad or does not have an image.

url

Type: string

Related

License

MIT © Patrick Tone

Current Tags

  • 1.3.2                                ...           latest (2 months ago)

7 Versions

  • 1.3.2                                ...           2 months ago
  • 1.3.0                                ...           9 months ago
  • 1.2.0                                ...           a year ago
  • 1.1.0                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.1.4                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 16
Last Day 1
Last Week 15
Last Month 14
Dependencies (3)
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |