Skip to content

Commit

Permalink
added logout readme and support for stream reading from fula
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Dec 19, 2022
1 parent 8779c2c commit c14d959
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ await fula.rm(

```

```js
//removes all Fula related data and information (Except the encrypted filesystem) at the specified storage local path
const result //returns true if succesful and false if fails
=
await fula.logout(
identity: string, //bytes of the privateKey of did identity in string format
storePath: string, // leave empty to use the default temp one
);

```

## Roadmap

Please note the following might not be done in order:
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.github.functionland:fula-build-aar:v0.7.4' // From jitpack.io
implementation 'com.github.functionland:wnfs-build-aar:v1.3.9' // From jitpack.io
implementation 'com.github.functionland:wnfs-build-aar:v1.4.0' // From jitpack.io
implementation 'commons-io:commons-io:20030203.000550'
// implementation files('mobile.aar')
}
5 changes: 3 additions & 2 deletions android/src/main/java/land/fx/fula/FulaModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,10 @@ public void ls(String path, Promise promise) {
Log.d("ReactNative", "ls: path = " + path);
try {
byte[] res = Fs.ls(this.client, this.rootConfig.getCid(), this.rootConfig.getPrivate_ref(), path);
Log.d("ReactNative", "ls: res = " + res);

//JSONArray jsonArray = new JSONArray(res);
String s = new String(res, StandardCharsets.UTF_8);
Log.d("ReactNative", "ls: res = " + s);
promise.resolve(s);
} catch (Exception e) {
Log.d("get", e.getMessage());
Expand Down Expand Up @@ -498,7 +499,7 @@ public void readFile(String fulaTargetFilename, String localFilename, Promise pr
ThreadUtils.runOnExecutor(() -> {
Log.d("ReactNative", "readFile: fulaTargetFilename = " + fulaTargetFilename);
try {
String path = Fs.readFileToPath(this.client, this.rootConfig.getCid(), this.rootConfig.getPrivate_ref(), fulaTargetFilename, localFilename);
String path = Fs.readFilestreamToPath(this.client, this.rootConfig.getCid(), this.rootConfig.getPrivate_ref(), fulaTargetFilename, localFilename);
promise.resolve(path);
} catch (Exception e) {
Log.d("get", e.getMessage());
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@functionland/react-native-fula",
"version": "0.4.7",
"version": "0.4.8",
"description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down

0 comments on commit c14d959

Please sign in to comment.