npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gme

v1.1.2

Published

modify google maps engine tables from node

Downloads

84

Readme

GME HAS BEEN DEPRECIATED BY GOOGLE, THERE IS NO REASON FO RYOU TO START USING THIS MODULE IF YOU HAVN'T BEEN PREVIOUSLY

Google Maps Engine NPM version

Wrapper for doing crud operations on Google Maps Engine tables.

No affiliations with Google blah blah etc.

All methods return promises.

var GME = require('gme');

GME.createTable(key, email, requestObj);

var table = new GME(key, email, tableID, primaryKey);

table.info(); //-> info about the table
table.features(); //-> all the features
table.readStream(); // -> same but read stream
table.features(query); //-> filtered list
table.readStream(query); // -> again same but with a read stream
table.feature(id); //-> one feature
table.create(array); //-> success/failure
table.update(array); //-> success/failure
table.remove(array); //-> success/failure

// Using bulk operations
var bulk = table.bulk();

bulk.([create|update|remove]); //-> ready for more/failure
bulk.flush(); //-> success/failure

// Using streams to write multiple rows
var stream = table.writeStream();

stream.write({
  type: 'create',
  value: {...}
});
stream.write({
  type: 'update',
  value: {...}
});
stream.write({
  type: 'remove',
  key: 'string'
});

Note: The key and the email are those of the service account for your GME account, to obtain a service account, see this document.

Once you obtain the private key, you must convert it to a pem file, with something like openssl pkcs12 -in key.p12 -out key.pem -nodes, where key.p12 is the downloaded file from the Service Account and key.pem is the file you pass as the key argument. The key parameter may either be the buffer contents of the key file or the string path to the keyfile.

The email and tableID arguments must be strings, primaryKey is optional and defaults to 'gx_id'.

For create and update takes an array of features per the create and update docs.

For remove an array of ids to delete is required.

table.bulk

bulk doesn't return a promise, but instead it returns a bulk object, which has the same create update and remove methods that work the same way, the only difference is that they wait util they have the maximum number of features or verticies and then does the upload in a batch.

i.e. bulk.create(feature); the first 49 times will return a promise that resolves to true but the 50th time it is a promise for the bulk upload of all 50 features.

bulk.flush forces an upload of all items in the current queue and cleans them out, flush doesn't close the object or anything so you can continue to use it.

table.writeStream

the writeStream method returns a writable stream, write objects with a type property with 'create', 'update', or 'remove' value and then a 'data' property with the object or string to put to the method (this can also be named 'key' if you want).

GME.createTable

Similar to the table constructor but instead of a table ID takes a table creation object.

table.features/table.readStream

Either returns all the rows or a filtered set based on a query, the only difference is that features returns a promise while readStream returns a stream., see this page for query options. Note that table.features does the pagination for you, you don't need to worry about it.