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

@nqminds/aliyun-oss-bridge-cli

v1.1.2

Published

A CLI for pushing/getting files for @nqminds/aliyun-oss-bridge

Downloads

2

Readme

Aliyun OSS Bridge CLI

Command-line-interface for uploading/downloading GeoTIFFs to TDX and Aliyun OSS.

Installation

You can install this package by using npm.

npm install @nqminds/aliyun-oss-bridge-cli

If you are checking out a development version, use lerna to install dependencies:

npx lerna bootstrap --scope @nqminds/aliyun-oss-bridge-cli --include-dependencies

Usage

You can either use npx aliyun-oss-bridge if you have npx installed, otherwise you can locate the binary in node_modules/.bin.

You can run npx aliyun-oss-bridge --help for help, or npx aliyun-oss-bridge <command> --help for help on a command.

$ aliyun-oss-bridge.js --help
aliyun-oss-bridge.js <command>

Commands:
  aliyun-oss-bridge.js upload               Uploads a file to the specified TDX
  <dataset-name> <filePath>                 dataset
  aliyun-oss-bridge.js download             Downloads a file from the given
  <dataset-name> <key> <filePath>           dataset.
  aliyun-oss-bridge.js list                 List all available datasets.

Options:
  --config         Load options and arguments from a JSON config file
                                            [default: .aliyun-oss-bridgerc.json]
  --tdx-id         The TDX ID to use for authentication      [string] [required]
  --tdx-secret     The TDX Secret to use for authentication  [string] [required]
  --aliyun-id      The Aliyun RAM Access ID to use for authentication
                                                             [string] [required]
  --aliyun-secret  The Aliyun RAM Access Secret to use for authentication
                                                             [string] [required]
  --tdx-folder-id  The id of the folder on the TDX  [string] [default: "2iQN6s"]
  --tdx-server     The url pointing to the TDX server
                                    [string] [default: "https://tdx.cropdoc.cn"]
  --tdx-ttl        The length of time (in seconds) your TDX login will be valid
                   for                       [number] [default: 3600 (One Hour)]
  --help           Show help                                           [boolean]
  --version        Show version number                                 [boolean]

Uploading a file

$ npx aliyun-oss-bridge upload --help
aliyun-oss-bridge upload <dataset-name> <filePath>

Uploads a file to the specified TDX dataset

Positionals:
  dataset-name  The name or id of the TDX dataset to upload to
                                                             [string] [required]
  filePath      The file to upload. Set to `-` to load from stdin
                                                             [string] [required]

Options:
  --config         Load options and arguments from a JSON config file
                                            [default: .aliyun-oss-bridgerc.json]
  --tdx-id         The TDX ID to use for authentication      [string] [required]
  --tdx-secret     The TDX Secret to use for authentication  [string] [required]
  --aliyun-id      The Aliyun RAM Access ID to use for authentication
                                                             [string] [required]
  --aliyun-secret  The Aliyun RAM Access Secret to use for authentication
                                                             [string] [required]
  --tdx-folder-id  The id of the folder on the TDX  [string] [default: "2iQN6s"]
  --tdx-server     The url pointing to the TDX server
                                    [string] [default: "https://tdx.cropdoc.cn"]
  --tdx-ttl        The length of time (in seconds) your TDX login will be valid
                   for                       [number] [default: 3600 (One Hour)]
  --help           Show help                                           [boolean]
  --version        Show version number                                 [boolean]
  --date           The date of the GeoTIFF as YYYY-MM-DD to store as metadata.
                                                                        [string]

Examples:
  aliyun-oss-bridge upload 'Potato       Uploads a GeoTiff file to the
  Planting Areas (O1)'                      dataset called 'Potato Planting
  /path/to/geotiff.tif --date 2019-12-25    Areas (O1). Adds the optional --date
                                            metadata of 25th December 2019.

You can use:

Options

You can store options in a JSON file, where each key is the name of the option. By default, the options will be loaded from a .aliyun-oss-bridgerc.json if it exists, but this can be overridden with the --config flag. For example:

{
  "tdx-id": "Your-tdx-sharekey-id",
  "tdx-secret": "your-tdx-sharekey-secret",
  "aliyun-id": "your-aliyun-RAM-account-id",
  "aliyun-secret": "your-aliyun-RAM-account-secret",
  "tdx-folder-id": "the-tdx-folder-that-stores-all-the-data",
  "tdx-server": "https://tdx.nqm-1.com"
}

Additionally, you can load options from environment variables, if they have the prefix ALIYUN_OSS_BRIDGE. For example, ALIYUN_OSS_BRIDGE_TDX_ID='Your-tdx-sharekey-id'.

Examples

For CropDoc MMU

Setup

Firstly, make sure that MMU's TDX sharekey is in the "Cropdoc MMU Importers" user group, so that they have the appropriate read/write permissions to access datasets.

Secondly, make sure that MMU's Aliyun RAM account access is in the "cropdoc-mmu" group. The permission policy is listed in @nqminds/cropdoc-schemas/system/oss-policy if you need to edit/recreate the group.

Finally, make a config JSON file that has the correct values for the TDX credentials, Aliyun RAM credentials, and the TDX CropDoc folder ID.

Usage

Installation

You can install this program by using npm.

Go into this directory and run

npm install @nqminds/aliyun-oss-bridge-cli
Config files

You should have access to two config files, which can be used with the --config flag:

  • cropdoc-mmu-test-uk.json uses UK servers, and can be used for fast testing.
  • cropdoc-mmu-china.json uses Chinese servers, and should be used for deployment.
List resources

To list the resources you have access to, run the following:

me@localhost: ~/aliyun-oss-bridge-cli $ npx aliyun-oss-bridge --config cropdoc-mmu-test-uk.json list
{
  '2iQN6s-potatoPlantingAreasO1': {
    id: '2iQN6s-potatoPlantingAreasO1',
    owner: '[email protected]/tdx.nqm-1.com',
    name: 'Potato Planting Areas (O1)'
  },
  '2iQN6s-diseaseOccurenceAreaO4': {
    id: '2iQN6s-diseaseOccurenceAreaO4',
    owner: '[email protected]/tdx.nqm-1.com',
    name: 'Disease Occurence Area (O4)'
  },
  '2iQN6s-blightOccurrenceAreaRO3': {
    id: '2iQN6s-blightOccurrenceAreaRO3',
    owner: '[email protected]/tdx.nqm-1.com',
    name: 'Late blight disease occurrence area R (O3)'
  },
  '2iQN6s-remoteSensingDataI1NasaGeotiff': {
    id: '2iQN6s-remoteSensingDataI1NasaGeotiff',
    owner: '[email protected]/tdx.nqm-1.com',
    name: 'Remote Sensing Data (I1)'
  }
}

Upload resources

You can upload GeoTIFF files to the above datasets using either their name or id:

me@localhost: ~/aliyun-oss-bridge-cli $ npx aliyun-oss-bridge --config cropdoc-mmu-test-uk.json upload '2iQN6s-blightOccurrenceAreaRO3' 1990-01-01.tif
Uploading key 1990-01-01.tif | ████████████████████████████████████████ | 100% || ETA: 0s'
Downloading resources

You can then download GeoTIFF files by specifying:

me@localhost: ~/aliyun-oss-bridge-cli $ npx aliyun-oss-bridge --config cropdoc-mmu-test-uk.json download '2iQN6s-blightOccurrenceAreaRO3' 1990-01-01.tif /tmp/path-to-download-to.tif
Download key 1990-01-01.tif | ████████████████████████████████████████ | 100% || ETA: 0s'