why-fs


To install, run:

haxelib install why-fs 0.1.0 

See using Haxelib in Haxelib documentation for more information.

README.md

Why File System

Abstraction of various (cloud) file systems. Mostly useful for reusing the same code for both local development and production environment. For example one may use the Local implementation while development on local machine and use the S3 implementation on production. Since they implements the same interface, the swapping can be as simple as this:

var fs:Fs = #if local new Local(root) #else new S3(bucket) #end;

// then use the `fs` instance everywhere

Interface

A quick glance:

interface Fs {
	function download(req:RequestInfo, local:String):Progress<Outcome<Noise, Error>>;
	function list(path:String, ?recursive:Bool):Promise<Array<Entry>>;
	function exists(path:String):Promise<Bool>;
	function move(from:String, to:String):Promise<Noise>;
	function copy(from:String, to:String):Promise<Noise>;
	function read(path:String):RealSource;
	function write(path:String, ?options:WriteOptions):RealSink;
	function delete(path:String):Promise<Noise>;
	function stat(path:String):Promise<Stat>;
	function getDownloadUrl(path:String, ?options:DownloadOptions):Promise<RequestInfo>;
	function getUploadUrl(path:String, ?options:UploadOptions):Promise<RequestInfo>;
}

Check out Fs.hx for the documentations of each method.

Usage

Pick one implementation from the why.fs package or roll your own.

Contributors
kevinresol
Version
0.1.0
Published
6 years ago
Dependencies
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub