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

@weborigami/gdrive

v0.0.5

Published

This package provides functions for treating a [Google Drive](https://www.google.com/drive/) folder as an [async tree](https://weborigami.org/async-tree/interface).

Downloads

4

Readme

This package provides functions for treating a Google Drive folder as an async tree.

It also allows you to read a Google Sheets spreadsheet range or Google Docs document as plain JSON.

Obtaining Google API credentials

This extension requires an API key from Google. Like most cloud platforms, gaining programmatic access is ridiculously complicated and requires you to navigate a maze of twisty little passages, all alike.

As of March 2024, the process to obtain a key is roughly:

  1. Open https://console.cloud.google.com.
  2. Select "Create Project" and fill out the details.
  3. From the side nav bar select "APIs & Services", then "API Library".
  4. Select "Google Drive API".
  5. Click "Enable".
  6. Click "Create Credentials". If asked what type, select "Service account".
  7. When asked "What data will you be accessing?", select "Application data".
  8. When asked to name the service account, enter anything that reflects the project you're creating.
  9. For "Role", select "Editor".
  10. Click "Done" to finish creating a service account.
  11. If you want to work with data in Google Sheets, you'll need to enable that API as well. From the side nav bar, select "APIs & Services", then "API Library". Search for "Google Sheets API", click that, then click "Enable".
  12. If you want to work with data in Google Docs, do the same with the Google Docs API.
  13. Select the service account you just created.
  14. Click "Keys", then "Add Key", then "Create new key".
  15. Indicate that you want a JSON key, then "Create".
  16. This will download a .json file to your computer; move that file into your project and rename it creds.json.
  17. It's important to not check this file into source control. E.g., add that to .gitignore.

Usage

  1. Use npm to install the main @weborigami/origami package and this @weborigami/gdrive extension.
  2. Obtain Google API credentials (above) and save the credentials as a file creds.json.
  3. Create a folder in Google Drive and "Share" it so that anyone with the link can view it.
  4. Identify the ID of that folder. When you open the folder in the browser, the URL will look like https://drive.google.com/drive/u/0/folders/<id>, where the <id> is a string of letters and numbers.
  5. Create a file called test.ori that will represent your authenticated access to that folder. Inside the file, paste this line:
package:@weborigami/gdrive/auth(creds.json)/<id goes here>

You can then use the Origami CLI to get a list of the files in the Google Drive folder:

$ ori @keys test.ori/
... list of file names in the Google Drive folder...

Or copy the Google Drive folder to a local folder called copied:

$ ori @copy test.ori, @files/copied