fission-suite / webnative-elm / Wnfs

Interact with your webnative filesystem.

Actions

publish : { tag : String } -> Request

Publish your changes to your filesystem. 📢 You should run this after doing mutations. See README examples for more info.

Mutations

mkdir : Base -> Attributes Webnative.Path.Directory -> Request

Create a directory.

mv : Base -> { from : Webnative.Path.Path t, to : Webnative.Path.Path t, tag : String } -> Request

Move something from one location to another.

rm : Base -> Attributes a -> Request

Remove something from the filesystem.

write : Base -> Attributes Webnative.Path.File -> Bytes -> Request

Write to a file using Bytes.

writeUtf8 : Base -> Attributes Webnative.Path.File -> String -> Request

Write to a file using a String.

Queries

exists : Base -> Attributes a -> Request

Check if something exists.

ls : Base -> Attributes Webnative.Path.Directory -> Request

List a directory.

read : Base -> Attributes Webnative.Path.File -> Request

Read a file from the filesystem in the form of Bytes.

readUtf8 : Base -> Attributes Webnative.Path.File -> Request

Read a file from the filesystem in the form of a String.

Aliases

add : Base -> Attributes Webnative.Path.File -> Bytes -> Request

Alias for write.

cat : Base -> Attributes Webnative.Path.File -> Request

Alias for read.

Requests & Responses


type Base
    = AppData AppPermissions
    | Private
    | Public

Base of the WNFS action.


type alias Attributes pathKind =
{ path : Webnative.Path.Path pathKind
, tag : String 
}

WNFS action attributes.


type Artifact
    = NoArtifact
    | Boolean Basics.Bool
    | CID String
    | DirectoryContent (List Entry)
    | FileContent Bytes
    | Utf8Content String

Artifact we receive in the response.


type alias Entry =
{ cid : String
, name : String
, kind : Webnative.Path.Kind
, size : Basics.Int 
}

Directory Entry.

context : String

Request/Response context.

Errors


type Error
    = DecodingError String
    | InvalidMethod String
    | TagParsingError String
    | JavascriptError String

Possible errors.

error : Error -> String

Error message.