goog-places-api
v0.0.3
Published
Modern library for Google Places https://developers.google.com/places/?hl=ru
Downloads
7
Readme
goog-places-api
Modern library for Google Places https://developers.google.com/places/?hl=ru
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