Git Product home page Git Product logo

awss3.jl's Introduction

AWSS3

AWS S3 Interface for Julia

CI Code Style: Blue ColPrac: Contributor's Guide on Collaborative Practices for Community Packages Documentation

using AWSS3
using AWS # for `global_aws_config`

aws = global_aws_config(; region="us-east-2") # pass keyword arguments to change defaults

s3_create_bucket(aws, "my.bucket")
s3_enable_versioning(aws, "my.bucket")

s3_put(aws, "my.bucket", "key", "Hello!")
println(s3_get(aws, "my.bucket", "key"))  # prints "Hello!"
println(s3_get(aws, "my.bucket", "key", byte_range=1:2))  # prints only "He"

S3Path

This package exports the S3Path object. This is an AbstractPath object as defined by FilePathsBase.jl, allowing users to use Julia's Base file system interface to obtain information from S3 buckets. See the below example.

julia> using AWSS3, AWS, FilePathsBase;

# global_aws_config() is also the default if no `config` argument is passed
julia> p = S3Path("s3://bucket-name/dir1/", config=global_aws_config());

julia> readdir(p)
1-element Vector{SubString{String}}:
 "demo.txt"

julia> file = joinpath(p, "demo.txt")
p"s3://bucket-name/dir1/demo.txt"

julia> stat(file)
Status(
  device = 0,
  inode = 0,
  mode = -rw-rw-rw-,
  nlink = 0,
  uid = 1000 (username),
  gid = 1000 (username),
  rdev = 0,
  size = 34 (34.0),
  blksize = 4096 (4.0K),
  blocks = 1,
  mtime = 2021-01-30T18:53:02,
  ctime = 2021-01-30T18:53:02,
)

julia> String(read(file))  # fetch the file into memory
"this is a file for testing S3Path\n"

julia> String(read(file, byte_range=1:4))  # fetch a specific byte range of the file
"this"

julia> rm(file)  # delete the file
UInt8[]

awss3.jl's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.