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

gcloud-backup-toolset

v1.0.1

Published

A toolset to easely backup and restore crypted backup archives from the google cloud storage service

Downloads

5

Readme

gcloud-backup-toolset

This package provides a toolset to create backups and store them with the google cloud storage service. Note that this is not an application to create backups, it's a toolset that requires to develop in javascript the recipe to collect the data to backup. It takes care of tarring, compressing, encrypting the data, and uploading it to your google cloud storage bucket.

Requirements

ES2015 is required (arrow functions and string templates mainly), so you need a recent version of node.

Install

From the npm registry

npm install --save gcloud-backup-toolset

Directly from github

npm install git+https://[email protected]:reyesr/gcloud-backup-toolset.git

Creating a backup

This package works by providing a toolset that does most of the common work involved in the process of creating a backup. Here is a template backup file

var configuration = {
    gCloudProjectId: "your-gcloudId-12345",
    gCloudKeyFilename: 'yourkeyfile-ab1234567890.json',
    gCloudBucket: "my-bucket-name",
    bucketSubdir: "optional-directory-name",
    aesKey: "LOzKM6wlcd3NlSPjoEXfSbJimJXtwtLgGawTLjCpzHoTQMcHX4xN9YX97KRjNEO1"
};

// tmpDir is a directory where you can store all the files to archive
// report is a report object you can user for logs and error
lib.doBackup(configuration, "my-backup-name", (tmpDir, report) => {
    // add files to tmpDir here
}).then((report)=>{
    console.log("backup complete");
    console.log(report.toString())
});

The configuration should contain at least the following keys:

  • gCloudProjectId
  • gCloudKeyFilename
  • gCloudBucket

The following keys are optional

  • reportName: a string to use as report name (default: "unnamed")
  • aesKey: a string that contains the AES key. If no aesKey is provided, the backup is not encrypted.
  • bucketSubdir: a subdirectory in the google cloud bucket where the backup should be store

Calling doBackup()

The function accepts multiple arguments

doBackup(configuration, taskArgument...)
  • configuration is a configuration object
  • Any argument after configuraton should be either
    • a string: it sets a name for the following task(s)
    • a function: a function to process the archiving. The doBackup function calls it with two arguments: a temporary folder (the function needs to put every file and folder to backup in it, doBackup then tars and bzip2 it), and a report object for reporting and logging.
    • If an array if provided, it is processed as a list of string/function

Example

doBackup(configuration, "my first task", someFunction, "Another task", anotherFunction, thirdFunction);

Restoring an archive

This is very similar to the backup, except it loads and decrypts the most recent file in the bucket (or in the subdirectory of the bucket, if specified)

var configuration = {
    gCloudProjectId: "your-gcloudId-12345",
    gCloudKeyFilename: 'yourkeyfile-ab1234567890.json',
    gCloudBucket: "my-bucket-name",
    bucketSubdir: "optional-directory-name",
    aesKey: "LOzKM6wlcd3NlSPjoEXfSbJimJXtwtLgGawTLjCpzHoTQMcHX4xN9YX97KRjNEO1" */
};

lib.restore(configuration)
    .then((file) => {
        console.log("File available:", file);
    })
    .error((err)=>{
        console.log("!!! Failed:", err);
    });

Reporting

TODO