README.md

giftlessclient

A Git LFS client library implemented in R, compatible with the Giftless Git LFS server.

Installation

You can install giftlessclient from GitHub with:

devtools::install_github("datopian/giftlessclient")

Example

To use giftlessclient you need to set up your lfs server URL in a environment variable:

Sys.setenv("LFS_SERVER_URL" = 'https://www.my-lfs-server.com')

Upload using multipart-basic transfer adapter

file_path <- "~/Documents/large-file.bin"
repository <- "repository"
dataset <- "large-dataset"
authz_token <- "eyJ0eXAiOiJK.eyJleHAiOjE2.WOalwa58Wr7_q3zm"

resp <- lfs_upload(file_path, repository, dataset, authz_token, transfer=c('multipart-basic'))

Returns two files attributes: sha256 of the file and it's size

> resp
$sha256
[1] "06c2e256b425f0222db6f14386aa827135043a0645f98e734d3c5cb2999e883f"

$size
[1] "51"

>

Upload using basic transfer adapter

file_path <- "~/Documents/my-small-csv.csv"
repository <- "repository"
dataset <- "small-dataset"
authz_token <- "eyJ0eXAiOiJK.eyJleHAiOjE2.WOalwa58Wr7_q3zm"

lfs_upload(file_path, repository, dataset, authz_token, transfer=c('basic'))

The transfers parameter is optional, and represents a list of supported transfer adapters by priority to negotiate with the server; Typically, there is no reason to provide this parameter.

Sending a batch request to the server

Send a batch request to the LFS server:

lfs_prefix <- 'organization/giftlessclient'
objects <- list(list(oid = '1231231', size = 12313))
authz_token <- "eyJ0eXAiOiJK.eyJleHAiOjE2.WOalwa58Wr7_q3zm"

batch(lfs_prefix, objects, authz_token, transfer = c('multipart-basic'))

License

giftlessclient is free software distributed under the terms of the MIT license. See LICENSE for details.

giftlessclient is (c) 2020 Datopian / Viderum Inc.



datopian/giftlessclient documentation built on Jan. 29, 2021, 3:40 p.m.