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

sync-cloud-storage

v1.0.0-rc.6

Published

[![NPM](https://img.shields.io/npm/v/sync-cloud-storage)](https://www.npmjs.com/package/sync-cloud-storage) [![Pipeline Status](https://github.com/msudgh/sync-cloud-storage/actions/workflows/ci.yml/badge.svg?branch=main)](./.github/workflows/ci.yml) [![Co

Downloads

15

Readme

sync-cloud-storage

NPM Pipeline Status Codecov Status License

sync-cloud-storage is a Node.js package designed to seamlessly synchronize files and directories between local environments and cloud storage providers like AWS S3. It leverages AWS SAM (Serverless) and AWS Cloud Development Kit (CDK) for powerful, modern, and flexible integrations.

Features

  • Sync multiple storage at once
  • Use pattern matching on finding files (single or multiple file/dir sync) by defining patterns of glob to include or exclude
  • Supports a set of options as following for each file based on storage features: Prefix, Access Control List (ACL), Tags, Metadata
  • Modern and uses the latest official cloud provider's SDK

Installation

  • npm: npm i sync-cloud-storage
  • yarn: yarn add sync-cloud-storage
  • pnpm: pnpm add sync-cloud-storage
  • ni: ni sync-cloud-storage

Usage

AWS S3

Serverless

The integration is powered by Serverless hooks and In below, the default configured hooks are listed:

  • scs:storages -> As a CLI command for serverless
  • scs:tags -> As a CLI command for serverless
  • scs:metadata -> As a CLI command for serverless
  • before:offline:start:init -> Sync storages (scs:storages)
  • before:deploy:deploy -> Sync storages (scs:storages)
Example

This setup uses before:deploy:deploy hook to sync storages before deploying the stack:

plugins:
  - sync-cloud-storage

custom:
  syncCloudStorage:
    - name: my-bucket
      patterns:
        - assets/*
      actions:
        - upload
        - delete
      prefix: assets
      acl: public-read
      metadata:
        foo: bar
        bar: foo
      tags:
        foo: bar
        bar: foo

CDK

Call storages action to sync after setting up a CDK App and Stack:

import { Stack, App } from '@aws-cdk/core'
import SyncCloudStorage from 'sync-cloud-storage'

const app = new App()
const stack = new Stack(app, 'MyStack')
const syncCloudStorage = new SyncCloudStorage(stack, {
  storages: [
    {
      name: 'my-bucket',
      patterns: ['assets/*'],
      actions: ['upload', 'delete'],
      prefix: 'assets',
      acl: 'public-read',
      metadata: {
        foo: 'bar',
        bar: 'foo',
      },
    },
  ],
})

syncCloudStorage.storages()

Options

General

| Option | Notes | Type | Required | Default | | -------- | ---------------------------------- | -------------------------------- | -------- | ---------------------------------------------------- | | storages | List of storages, Minimum items: 1 | array of storage | true | undefined | | region | Cloud (AWS) region | string | false | undefined or AWS_REGION environment variable | | endpoint | Cloud (AWS) Endpoint URL | string | false | undefined or AWS_ENDPOINT_URL environment variable | | offline | Offline mode | boolean | false | false or IS_OFFLINE environment variable | | disabled | Disable sync | boolean | false | false | | silent | Silent output logs | boolean | false | false |

Storage

| Option | Notes | Type | Required | Default | | ----------- | ----------------------------------------------------------------------------------------------------------- | ------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ | | name | Name of storage (AWS S3 Bucket), Minimum length: 1 | string | true | undefined | | patterns | Patterns of glob paths to include or exclude on sync action, Minimum items: 1 | array of string | true | undefined | | actions | Sync actions, Valid values: upload, delete | array of string | false | upload: Only upload new or modified file, delete: Only delete files that are not in the local environment from the storage | | prefix | Prefix for the storage files and folders | string | false | '' | | enabled | Enable or disable the storage on sync action | boolean | false | true | | acl | AWS S3 Canned ACL, Valid values: private, public-read, public-read-write, authenticated-read | string | false | undefined | | metadata | A set of metadata key/value pair to be set or unset on the object | object | false | undefined | | tags | A set of tag key/value pair to be set or unset on the object | object | false | undefined | | gitignore | Use .gitignore file to exclude files and directories | boolean | false | false | | ignoreFiles | Ignore files and directories to exclude from sync action | array of string | false | undefined |