GithubHelp home page GithubHelp logo

tekdreams / images-downloader Goto Github PK

View Code? Open in Web Editor NEW
19.0 4.0 10.0 8 KB

A Node.js module for downloading a single image or multiple images to disk from a given Url

Home Page: https://www.npmjs.com/package/images-downloader

License: MIT License

JavaScript 100.00%
image image-processing images downloader download-photos download crawler photos photo jpeg

images-downloader's Introduction

Build Status

Images downloader

A Node.js module for downloading a single image or multiple images to disk from a given Url (checking if urls exist and detecting image type)

Prerequisites

Node.js - Version >=4.3.2

Installation

Use npm:

$ npm install images-downloader --save

Or you can clone and install HEAD:

git clone https://github.com/tekdreams/images-downloader.git
cd images-downloader
npm install

Usage

const download = require('images-downloader').images;

// The file will be downloaded to this directory. For example: __dirname + '/mediatheque'
const dest = 'path/to/dest'

// An array of image(s) to download
const images = ['http://url.com/image1.jpg',
	'http://url.com/image2.png',
	'http://url.com/image3.gif']

To download your single or multiple images use the following...

download(images, dest)
.then(result => {
	console.log('Images downloaded', result);	
})
.catch(error => console.log("downloaded error", error))

The result returned in from the promise will be a Result array.

Returned Data

The module returns an array. Below is an example:

 [{ filename: 'path/to/image_3233.jpeg',
    status: 'downloaded',
    url: 'http://url.com/image1.jpg' },
  { filename: null,
    status: 'Images allowed only',
    url: 'http://url.com/image1.jpg' }]

Tests

npm test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

License

Copyright © 2017 Tekdreams. MIT Licensed.

images-downloader's People

Contributors

baozdemir avatar tekdreams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

images-downloader's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.