GithubHelp home page GithubHelp logo

peternator7 / storage-copy Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 9 KB

A short script to experiment with writing to Azure Blob storage using haskell's req library.

License: BSD 3-Clause "New" or "Revised" License

Haskell 100.00%

storage-copy's Introduction

storage-copy

Here's a short little script I wrote to upload a local directory to Azure blob storage using Haskell. This was for my own enrichment, but feel free to take a peek if you so desire. Most of the interesting code is in ./src/Lib.hs.

How to use

When prompted, enter the path to the directory that you would like to upload. Then enter the name of the blob storage account you would like to use. If your blob storage account url looks like https://myblobstorage.blob.core.windows.net/ then you would say myblobstorage. Then for the final question, enter your Shared Access Signature without the ?. You can generate a SAS in the azure portal.

How it works.

The script creates a new container with the name of the directory. For example, running the script with the project directory of this repo would create a container called storage-copy in azure. It then walks all the directories uploading every file that it finds to that container with the path relative to the root. Empty directories won't be uploaded because they contain no contents.

Caveats

The script does minimal error handling. It will recover if the container already exists, but all other errors will crash the program. The PUT Blob method has a size limit of 100MB. There are other methods to upload large files, but this script does not fall back on them so the upload will fail.

In a few tests, it doesn't work on Windows. This appears to be an issue with the req networking package (or potentially one of it's dependencies). I haven't tried it on the Linux Subsystem for Windows. That might be a workaround.

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.