Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mongodb-js/dl-center

Package Overview
Dependencies
Maintainers
31
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mongodb-js/dl-center

mongodb download center internal tools

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
40K
decreased by-22.1%
Maintainers
31
Weekly downloads
 
Created
Source

Download center tools

Provides a set of functions to aid releases to the download center.

Features

  • Pre-configured ACLs
  • Upload and download assets
  • Validates and uploads product configurations
  • Checks for broken urls in configurations

Usage

Create a new DownloadCenter instance
import { DownloadCenter } from '@mongodb-js/dl-center';

const bucketConfig = {
  bucket: `${process.env.MONGODB_DOWNLOADS_BUCKET_NAME}`,
  accessKeyId: `${process.env.MONGODB_DOWNLOADS_AWS_ACCESS_KEY_ID}`,
  secretAccessKey: `${process.env.MONGODB_DOWNLOADS_AWS_SECRET_ACCESS_KEY}`
};

const downloadCenter = new DownloadCenter(bucketConfig);
Validate and upload a configuration

downloadCenter.uploadConfig validates a configuration against a json schema, checks that all the download links are reacheable and uploads the configuration to the download center.

const compassConfig = {
  versions: [ /* ... */ ],
  // ...
};

await downloadCenter.uploadConfig('compass/compass.json', compassConfig);
Download a configuration
const config = await downloadCenter.downloadConfig('compass/compass.json');
assert(config.versions.length > 1);
Upload an asset
const config = await downloadCenter.uploadAsset(
  'compass/assets/compass.tgz',
  fs.createReadStream('./compass.tgz'),
  { contentType: 'application/gzip' } // contentType is optional
);
Download an asset
const buffer = await downloadCenter.downloadAsset(
  'compass/assets/compass.tgz'
);

fs.writeFileSync('./compass.tgz', buffer);
Validates a configuration without uploading it
import { validateConfig } from '@mongodb-js/dl-center';

await validateConfig({ /* ... */ });
Wait for assets upload

This can be used to wait for the assets of a release to be available before publishing a new configuration:

const { ok, status } = await probePlatformDownloadLink(platform);

FAQs

Package last updated on 03 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc