4 people like it.

Amazon S3 API

Partial wrapper for Amazon S3 for both the Web and SOAP APIs. Generates signatures for both APIs (which was the tricky part). Uses WSDL Type Provider for SOAP. Uses SOAP for bucket list and delete operations and WebAPI to upload/download object contents (streamed / async)

  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
117: 
118: 
119: 
module S3
open System
open System.Text
open System.Web
open System.Net
open System.Security.Cryptography
open System.IO
open System.Xml
open Microsoft.FSharp.Data.TypeProviders
open System.ServiceModel
open System.Threading.Tasks

type s3 = WsdlService<"http://s3.amazonaws.com/doc/2006-03-01/AmazonS3.wsdl">
let aws_key_id ="<your key id>"
let aws_sec = "<your secret>"

let signString (str:string) =
    let key = Encoding.UTF8.GetBytes(aws_sec)
    let alg = HMACSHA1.Create()
    alg.Key <- key
    let sigBytes = Encoding.UTF8.GetBytes(str)
    let hash = alg.ComputeHash(sigBytes)
    let hashStr = Convert.ToBase64String(hash)
    hashStr

let sigStr verb bucket subResource ts =
    let canRes = sprintf "/%s/%s" bucket subResource
    let ts_header = sprintf "x-amz-date:%s" ts
    String.Join("\n",
        [|
            verb
            ""//md5
            ""//content type
            ""//date
            ts_header
            canRes
        |])

let soapSig op = 
    let dtn = DateTime.UtcNow
    let dt = new DateTime(dtn.Year,dtn.Month,dtn.Day,dtn.Hour,dtn.Minute,dtn.Second,1)
    let ts = XmlConvert.ToString(dt,XmlDateTimeSerializationMode.Utc)
    let str = sprintf "AmazonS3%s%s" op ts
    let sigStr = signString str
    sigStr,dt

let AsyncAwaitVoidTask (task : Task) =
    Async.AwaitIAsyncResult(task) |> Async.Ignore

let putAsync (inStream:Stream) bucket subResource =
    async {
            let mthd = "PUT"
            let ts = DateTime.UtcNow.ToString("r")
            let sigStr = sigStr mthd bucket subResource ts
            let hashStr = signString sigStr
            let authHeader = sprintf "AWS %s:%s" aws_key_id hashStr
            let url = sprintf "https://%s.s3.amazonaws.com/%s" bucket subResource
            let wc = HttpWebRequest.CreateHttp(url)
            wc.Method <- mthd
            wc.Headers.Add("x-amz-date",ts)
            wc.Headers.Add(HttpRequestHeader.Authorization,authHeader)
            let! outStream = wc.GetRequestStreamAsync() |> Async.AwaitTask
            do! AsyncAwaitVoidTask (inStream.CopyToAsync(outStream))
            outStream.Flush()
            outStream.Close()
            let resp = wc.GetResponse()
            resp.Close()
        }

let getAsync bucket subResource =
    async {
            let mthd = "GET"
            let ts = DateTime.UtcNow.ToString("r")
            let sigStr = sigStr mthd bucket subResource ts
            let hashStr = signString sigStr
            let authHeader = sprintf "AWS %s:%s" aws_key_id hashStr
            let url = sprintf "https://%s.s3.amazonaws.com/%s" bucket subResource
            let wc = HttpWebRequest.CreateHttp(url)
            wc.Method <- mthd
            wc.Headers.Add("x-amz-date",ts)
            wc.Headers.Add(HttpRequestHeader.Authorization,authHeader)
            let! resp = wc.GetResponseAsync() |> Async.AwaitTask
            return resp
        }

let private runOp op f  =
    let b = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
    b.MaxReceivedMessageSize <- 10000000L
    let epr = new EndpointAddress("https://s3.amazonaws.com/soap")
    use ser = new s3.ServiceTypes.AmazonS3Client(b,epr)
    try
        let sign,ts = soapSig op
        let resp = f ser sign ts
        ser.Close()
        resp
    with ex -> 
        ser.Abort()
        raise ex

let listBucket bucket =
    runOp "ListBucket" <|
        fun ser sign ts -> ser.ListBucket(bucket,null,null,1000,null,aws_key_id,ts,sign,null)

let deleteObj bucket file =
    runOp "DeleteObject" <|
        fun ser sign ts -> ser.DeleteObject(bucket,file,aws_key_id,ts,sign,null)


let downloadRaw bucket file dnldDir = 
    if Directory.Exists dnldDir |> not then
        Directory.CreateDirectory dnldDir |> ignore
    let path = Path.Combine(dnldDir,file)
    async {
        use outStream = File.Create path 
        use! resp = getAsync bucket file
        use inStream = resp.GetResponseStream()
        do! AsyncAwaitVoidTask (inStream.CopyToAsync(outStream))
        printfn "download completed %s" file
        }
module S3
namespace System
namespace System.Text
namespace System.Web
namespace System.Net
namespace System.Security
namespace System.Security.Cryptography
namespace System.IO
namespace System.Xml
namespace Microsoft
namespace Microsoft.FSharp
namespace Microsoft.FSharp.Data
namespace System.Threading
namespace System.Threading.Tasks
type s3 = obj

Full name: S3.s3
val aws_key_id : string

Full name: S3.aws_key_id
val aws_sec : string

Full name: S3.aws_sec
val signString : str:string -> string

Full name: S3.signString
val str : string
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = String

Full name: Microsoft.FSharp.Core.string
val key : byte []
type Encoding =
  member BodyName : string
  member Clone : unit -> obj
  member CodePage : int
  member DecoderFallback : DecoderFallback with get, set
  member EncoderFallback : EncoderFallback with get, set
  member EncodingName : string
  member Equals : value:obj -> bool
  member GetByteCount : chars:char[] -> int + 3 overloads
  member GetBytes : chars:char[] -> byte[] + 5 overloads
  member GetCharCount : bytes:byte[] -> int + 2 overloads
  ...

Full name: System.Text.Encoding
property Encoding.UTF8: Encoding
Encoding.GetBytes(s: string) : byte []
Encoding.GetBytes(chars: char []) : byte []
Encoding.GetBytes(chars: char [], index: int, count: int) : byte []
Encoding.GetBytes(chars: nativeptr<char>, charCount: int, bytes: nativeptr<byte>, byteCount: int) : int
Encoding.GetBytes(s: string, charIndex: int, charCount: int, bytes: byte [], byteIndex: int) : int
Encoding.GetBytes(chars: char [], charIndex: int, charCount: int, bytes: byte [], byteIndex: int) : int
val alg : HMAC
Multiple items
type HMACSHA1 =
  inherit HMAC
  new : unit -> HMACSHA1 + 2 overloads

Full name: System.Security.Cryptography.HMACSHA1

--------------------
HMACSHA1() : unit
HMACSHA1(key: byte []) : unit
HMACSHA1(key: byte [], useManagedSha1: bool) : unit
HMAC.Create() : HMAC
HMAC.Create(algorithmName: string) : HMAC
property HMAC.Key: byte []
val sigBytes : byte []
val hash : byte []
HashAlgorithm.ComputeHash(buffer: byte []) : byte []
HashAlgorithm.ComputeHash(inputStream: Stream) : byte []
HashAlgorithm.ComputeHash(buffer: byte [], offset: int, count: int) : byte []
val hashStr : string
type Convert =
  static val DBNull : obj
  static member ChangeType : value:obj * typeCode:TypeCode -> obj + 3 overloads
  static member FromBase64CharArray : inArray:char[] * offset:int * length:int -> byte[]
  static member FromBase64String : s:string -> byte[]
  static member GetTypeCode : value:obj -> TypeCode
  static member IsDBNull : value:obj -> bool
  static member ToBase64CharArray : inArray:byte[] * offsetIn:int * length:int * outArray:char[] * offsetOut:int -> int + 1 overload
  static member ToBase64String : inArray:byte[] -> string + 3 overloads
  static member ToBoolean : value:obj -> bool + 17 overloads
  static member ToByte : value:obj -> byte + 18 overloads
  ...

Full name: System.Convert
Convert.ToBase64String(inArray: byte []) : string
Convert.ToBase64String(inArray: byte [], options: Base64FormattingOptions) : string
Convert.ToBase64String(inArray: byte [], offset: int, length: int) : string
Convert.ToBase64String(inArray: byte [], offset: int, length: int, options: Base64FormattingOptions) : string
val sigStr : verb:string -> bucket:string -> subResource:string -> ts:string -> string

Full name: S3.sigStr
val verb : string
val bucket : string
val subResource : string
val ts : string
val canRes : string
val sprintf : format:Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
val ts_header : string
Multiple items
type String =
  new : value:char -> string + 7 overloads
  member Chars : int -> char
  member Clone : unit -> obj
  member CompareTo : value:obj -> int + 1 overload
  member Contains : value:string -> bool
  member CopyTo : sourceIndex:int * destination:char[] * destinationIndex:int * count:int -> unit
  member EndsWith : value:string -> bool + 2 overloads
  member Equals : obj:obj -> bool + 2 overloads
  member GetEnumerator : unit -> CharEnumerator
  member GetHashCode : unit -> int
  ...

Full name: System.String

--------------------
String(value: nativeptr<char>) : unit
String(value: nativeptr<sbyte>) : unit
String(value: char []) : unit
String(c: char, count: int) : unit
String(value: nativeptr<char>, startIndex: int, length: int) : unit
String(value: nativeptr<sbyte>, startIndex: int, length: int) : unit
String(value: char [], startIndex: int, length: int) : unit
String(value: nativeptr<sbyte>, startIndex: int, length: int, enc: Encoding) : unit
String.Join(separator: string, values: Collections.Generic.IEnumerable<string>) : string
String.Join<'T>(separator: string, values: Collections.Generic.IEnumerable<'T>) : string
String.Join(separator: string, [<ParamArray>] values: obj []) : string
String.Join(separator: string, [<ParamArray>] value: string []) : string
String.Join(separator: string, value: string [], startIndex: int, count: int) : string
val soapSig : op:string -> string * DateTime

Full name: S3.soapSig
val op : string
val dtn : DateTime
Multiple items
type DateTime =
  struct
    new : ticks:int64 -> DateTime + 10 overloads
    member Add : value:TimeSpan -> DateTime
    member AddDays : value:float -> DateTime
    member AddHours : value:float -> DateTime
    member AddMilliseconds : value:float -> DateTime
    member AddMinutes : value:float -> DateTime
    member AddMonths : months:int -> DateTime
    member AddSeconds : value:float -> DateTime
    member AddTicks : value:int64 -> DateTime
    member AddYears : value:int -> DateTime
    ...
  end

Full name: System.DateTime

--------------------
DateTime()
   (+0 other overloads)
DateTime(ticks: int64) : unit
   (+0 other overloads)
DateTime(ticks: int64, kind: DateTimeKind) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, calendar: Globalization.Calendar) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: DateTimeKind) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: Globalization.Calendar) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: DateTimeKind) : unit
   (+0 other overloads)
property DateTime.UtcNow: DateTime
val dt : DateTime
property DateTime.Year: int
property DateTime.Month: int
property DateTime.Day: int
property DateTime.Hour: int
property DateTime.Minute: int
property DateTime.Second: int
Multiple items
type XmlConvert =
  new : unit -> XmlConvert
  static member DecodeName : name:string -> string
  static member EncodeLocalName : name:string -> string
  static member EncodeName : name:string -> string
  static member EncodeNmToken : name:string -> string
  static member IsNCNameChar : ch:char -> bool
  static member IsPublicIdChar : ch:char -> bool
  static member IsStartNCNameChar : ch:char -> bool
  static member IsWhitespaceChar : ch:char -> bool
  static member IsXmlChar : ch:char -> bool
  ...

Full name: System.Xml.XmlConvert

--------------------
XmlConvert() : unit
XmlConvert.ToString(value: Guid) : string
   (+0 other overloads)
XmlConvert.ToString(value: DateTimeOffset) : string
   (+0 other overloads)
XmlConvert.ToString(value: TimeSpan) : string
   (+0 other overloads)
XmlConvert.ToString(value: float) : string
   (+0 other overloads)
XmlConvert.ToString(value: float32) : string
   (+0 other overloads)
XmlConvert.ToString(value: uint64) : string
   (+0 other overloads)
XmlConvert.ToString(value: uint32) : string
   (+0 other overloads)
XmlConvert.ToString(value: uint16) : string
   (+0 other overloads)
XmlConvert.ToString(value: byte) : string
   (+0 other overloads)
XmlConvert.ToString(value: int64) : string
   (+0 other overloads)
type XmlDateTimeSerializationMode =
  | Local = 0
  | Utc = 1
  | Unspecified = 2
  | RoundtripKind = 3

Full name: System.Xml.XmlDateTimeSerializationMode
field XmlDateTimeSerializationMode.Utc = 1
val sigStr : string
val AsyncAwaitVoidTask : task:Task -> Async<unit>

Full name: S3.AsyncAwaitVoidTask
val task : Task
Multiple items
type Task =
  new : action:Action -> Task + 7 overloads
  member AsyncState : obj
  member ContinueWith : continuationAction:Action<Task> -> Task + 9 overloads
  member CreationOptions : TaskCreationOptions
  member Dispose : unit -> unit
  member Exception : AggregateException
  member Id : int
  member IsCanceled : bool
  member IsCompleted : bool
  member IsFaulted : bool
  ...

Full name: System.Threading.Tasks.Task

--------------------
type Task<'TResult> =
  inherit Task
  new : function:Func<'TResult> -> Task<'TResult> + 7 overloads
  member ContinueWith : continuationAction:Action<Task<'TResult>> -> Task + 9 overloads
  member Result : 'TResult with get, set
  static member Factory : TaskFactory<'TResult>

Full name: System.Threading.Tasks.Task<_>

--------------------
Task(action: Action) : unit
Task(action: Action, cancellationToken: Threading.CancellationToken) : unit
Task(action: Action, creationOptions: TaskCreationOptions) : unit
Task(action: Action<obj>, state: obj) : unit
Task(action: Action, cancellationToken: Threading.CancellationToken, creationOptions: TaskCreationOptions) : unit
Task(action: Action<obj>, state: obj, cancellationToken: Threading.CancellationToken) : unit
Task(action: Action<obj>, state: obj, creationOptions: TaskCreationOptions) : unit
Task(action: Action<obj>, state: obj, cancellationToken: Threading.CancellationToken, creationOptions: TaskCreationOptions) : unit

--------------------
Task(function: Func<'TResult>) : unit
Task(function: Func<'TResult>, cancellationToken: Threading.CancellationToken) : unit
Task(function: Func<'TResult>, creationOptions: TaskCreationOptions) : unit
Task(function: Func<obj,'TResult>, state: obj) : unit
Task(function: Func<'TResult>, cancellationToken: Threading.CancellationToken, creationOptions: TaskCreationOptions) : unit
Task(function: Func<obj,'TResult>, state: obj, cancellationToken: Threading.CancellationToken) : unit
Task(function: Func<obj,'TResult>, state: obj, creationOptions: TaskCreationOptions) : unit
Task(function: Func<obj,'TResult>, state: obj, cancellationToken: Threading.CancellationToken, creationOptions: TaskCreationOptions) : unit
Multiple items
type Async
static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member AwaitTask : task:Task<'T> -> Async<'T>
static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : computation:Async<'T> -> Async<unit>
static member OnCancel : interruption:(unit -> unit) -> Async<IDisposable>
static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:CancellationToken -> 'T
static member Sleep : millisecondsDueTime:int -> Async<unit>
static member Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T>
static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken -> unit
static member SwitchToContext : syncContext:SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken

Full name: Microsoft.FSharp.Control.Async

--------------------
type Async<'T>

Full name: Microsoft.FSharp.Control.Async<_>
static member Async.AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member Async.Ignore : computation:Async<'T> -> Async<unit>
val putAsync : inStream:Stream -> bucket:string -> subResource:string -> Async<unit>

Full name: S3.putAsync
val inStream : Stream
type Stream =
  inherit MarshalByRefObject
  member BeginRead : buffer:byte[] * offset:int * count:int * callback:AsyncCallback * state:obj -> IAsyncResult
  member BeginWrite : buffer:byte[] * offset:int * count:int * callback:AsyncCallback * state:obj -> IAsyncResult
  member CanRead : bool
  member CanSeek : bool
  member CanTimeout : bool
  member CanWrite : bool
  member Close : unit -> unit
  member CopyTo : destination:Stream -> unit + 1 overload
  member Dispose : unit -> unit
  member EndRead : asyncResult:IAsyncResult -> int
  ...

Full name: System.IO.Stream
val async : AsyncBuilder

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
val mthd : string
DateTime.ToString() : string
DateTime.ToString(provider: IFormatProvider) : string
DateTime.ToString(format: string) : string
DateTime.ToString(format: string, provider: IFormatProvider) : string
val authHeader : string
val url : string
val wc : obj
type HttpWebRequest =
  inherit WebRequest
  member Abort : unit -> unit
  member Accept : string with get, set
  member AddRange : range:int -> unit + 7 overloads
  member Address : Uri
  member AllowAutoRedirect : bool with get, set
  member AllowWriteStreamBuffering : bool with get, set
  member AutomaticDecompression : DecompressionMethods with get, set
  member BeginGetRequestStream : callback:AsyncCallback * state:obj -> IAsyncResult
  member BeginGetResponse : callback:AsyncCallback * state:obj -> IAsyncResult
  member ClientCertificates : X509CertificateCollection with get, set
  ...

Full name: System.Net.HttpWebRequest
type HttpRequestHeader =
  | CacheControl = 0
  | Connection = 1
  | Date = 2
  | KeepAlive = 3
  | Pragma = 4
  | Trailer = 5
  | TransferEncoding = 6
  | Upgrade = 7
  | Via = 8
  | Warning = 9
  ...

Full name: System.Net.HttpRequestHeader
field HttpRequestHeader.Authorization = 24
val outStream : obj
static member Async.AwaitTask : task:Task<'T> -> Async<'T>
val resp : obj
val getAsync : bucket:string -> subResource:string -> Async<'a>

Full name: S3.getAsync
val resp : 'a
val private runOp : op:string -> f:(#IDisposable -> string -> DateTime -> 'b) -> 'b

Full name: S3.runOp
val f : (#IDisposable -> string -> DateTime -> 'b)
val b : obj
val epr : obj
val ser : #IDisposable
val sign : string
val ts : DateTime
val resp : 'b
val ex : exn
val raise : exn:Exception -> 'T

Full name: Microsoft.FSharp.Core.Operators.raise
val listBucket : bucket:'a -> 'b

Full name: S3.listBucket
val bucket : 'a
val ser : IDisposable
val deleteObj : bucket:'a -> file:'b -> 'c

Full name: S3.deleteObj
val file : 'b
val downloadRaw : bucket:string -> file:string -> dnldDir:string -> Async<unit>

Full name: S3.downloadRaw
val file : string
val dnldDir : string
type Directory =
  static member CreateDirectory : path:string -> DirectoryInfo + 1 overload
  static member Delete : path:string -> unit + 1 overload
  static member EnumerateDirectories : path:string -> IEnumerable<string> + 2 overloads
  static member EnumerateFileSystemEntries : path:string -> IEnumerable<string> + 2 overloads
  static member EnumerateFiles : path:string -> IEnumerable<string> + 2 overloads
  static member Exists : path:string -> bool
  static member GetAccessControl : path:string -> DirectorySecurity + 1 overload
  static member GetCreationTime : path:string -> DateTime
  static member GetCreationTimeUtc : path:string -> DateTime
  static member GetCurrentDirectory : unit -> string
  ...

Full name: System.IO.Directory
Directory.Exists(path: string) : bool
val not : value:bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
Directory.CreateDirectory(path: string) : DirectoryInfo
Directory.CreateDirectory(path: string, directorySecurity: Security.AccessControl.DirectorySecurity) : DirectoryInfo
val ignore : value:'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore
val path : string
type Path =
  static val DirectorySeparatorChar : char
  static val AltDirectorySeparatorChar : char
  static val VolumeSeparatorChar : char
  static val InvalidPathChars : char[]
  static val PathSeparator : char
  static member ChangeExtension : path:string * extension:string -> string
  static member Combine : [<ParamArray>] paths:string[] -> string + 3 overloads
  static member GetDirectoryName : path:string -> string
  static member GetExtension : path:string -> string
  static member GetFileName : path:string -> string
  ...

Full name: System.IO.Path
Path.Combine([<ParamArray>] paths: string []) : string
Path.Combine(path1: string, path2: string) : string
Path.Combine(path1: string, path2: string, path3: string) : string
Path.Combine(path1: string, path2: string, path3: string, path4: string) : string
val outStream : FileStream
type File =
  static member AppendAllLines : path:string * contents:IEnumerable<string> -> unit + 1 overload
  static member AppendAllText : path:string * contents:string -> unit + 1 overload
  static member AppendText : path:string -> StreamWriter
  static member Copy : sourceFileName:string * destFileName:string -> unit + 1 overload
  static member Create : path:string -> FileStream + 3 overloads
  static member CreateText : path:string -> StreamWriter
  static member Decrypt : path:string -> unit
  static member Delete : path:string -> unit
  static member Encrypt : path:string -> unit
  static member Exists : path:string -> bool
  ...

Full name: System.IO.File
File.Create(path: string) : FileStream
File.Create(path: string, bufferSize: int) : FileStream
File.Create(path: string, bufferSize: int, options: FileOptions) : FileStream
File.Create(path: string, bufferSize: int, options: FileOptions, fileSecurity: Security.AccessControl.FileSecurity) : FileStream
val resp : IDisposable
val inStream : IDisposable
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
Raw view Test code New version

More information

Link:http://fssnip.net/k3
Posted:11 years ago
Author:Faisal Waris
Tags: amazon , s3 , cloud