0.0.3 • Published 7 years ago

goog-places-api v0.0.3

Weekly downloads
5
License
ISC
Repository
github
Last release
7 years ago

goog-places-api

Modern library for Google Places https://developers.google.com/places/?hl=ru

NPM version Build Status Dependency Status Coverage percentage experimental

Install

npm install goog-places-api --save

or

yarn add goog-places-api

Usage

import Api from "goog-places-api";

const api = Api("key1");

// Iterator for all places in area

for await (const loc of api.nearby("55.7494733,37.3523209", 50000, {
    keyword: "restaurant",
})) {

    // Get detail for current place

    const location = await api.details(loc.place_id);

    console.log(location.name);

    // Get first photo to buffer

    const buf = await api.photo(location.photos[0].photo_reference);

    // Write photo to file

    require("fs").writeFileSync(__dirname + "/1.jpg", buf);

    break;
}

Test

npm install
npm test