#google-cloud #cloud-storage #cloud #google #sync #rsync

cloud-storage-sync

Embedded rsync-like local files and Google Cloud Storage buckets

14 releases (6 breaking)

0.6.0 May 21, 2021
0.5.0 Mar 5, 2021
0.4.0 Jan 23, 2021
0.3.0 Aug 25, 2020
0.2.4 Jul 16, 2020

#789 in Filesystem

40 downloads per month

Custom license

34KB
771 lines

cloud-storage-sync

docs

Library to sync files to, from and between Google Cloud Storage buckets

This project depends on cloud-storage-rs crate. To access bucket you need to specify SERVICE_ACCOUNT environment variable which should contain path to the service account json key.

let force_overwrite = false;
let sync = Sync::new(force_overwrite);

for i in 1..=2 {
    let op_count = sync.sync_local_to_gcs(
        "/some/local/file_or_dir", 
        BUCKET,
        "some/directory",
    ).await?;
    
    if i == 2 {
        assert_eq!(op_count, 0); // passes
    }

    let op_count = sync.sync_gcs_to_local(
        BUCKET,
        "myprefix",
        "../some/directory"
    ).await?;
    
    if i == 2 {
        assert_eq!(op_count, 0); // passes
    }
}

Dependencies

~21–37MB
~701K SLoC