fission-codes/webnative-elm/1.0.0

NOTE: the latest version is 3.0.0

Formerly fission-suite/webnative-elm. Search finds this package by either name.

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 Directory -> Request

Create a directory.

mv :
-> { from : Path t
, to : 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 File -> Bytes -> Request

Write to a file using Bytes.

writeUtf8 : Base -> Attributes File -> String -> Request

Write to a file using a String.

Queries

exists : Base -> Attributes a -> Request

Check if something exists.

ls : Base -> Attributes Directory -> Request

List a directory.

read : Base -> Attributes File -> Request

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

readUtf8 : Base -> Attributes File -> Request

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

Aliases

add : Base -> Attributes File -> Bytes -> Request

Alias for write.

cat : Base -> Attributes File -> Request

Alias for read.

Requests & Responses

type Base
= AppData AppPermissions
| Private
| Public

Base of the WNFS action.

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

WNFS action attributes.

= NoArtifact
| Boolean Bool
| CID String
| DirectoryContent (List Entry)
| FileContent Bytes
| Utf8Content String

Artifact we receive in the response.

type alias Entry =
{ cid : String
, name : String
, kind : Kind
, size : 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.