0.9.7 • Published 1 year ago

@polywrap/fs-plugin-js v0.9.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@polywrap/fs-plugin-js

Filesystem Plugin allows the Polywrap JS Client to interact with the local filesystem.

Usage

import { PolywrapClient } from "@polywrap/client-js";
import { filesystemPlugin } from "@polywrap/fs-plugin-js";

// query a local wrapper
export async function foo({

  const filesystemPluginUri = "wrap://ens/fs.polywrap.eth";

  // initialize the client with eth, ipfs, ens plugins
  client = new PolywrapClient({
    plugins: [
      {
        uri: filesystemPluginUri,
        plugin: fileSystemPlugin({}),
      },
    ],
  });

  const sampleFilePath = path.resolve(__dirname, "samples/sample.txt");

  // and read from filesystem
  const response = await client.invoke<string>({
    filesystemPluginUri,
    method: "readFile",
    input: {
      path: sampleFilePath,
    },
  });

  // or instantiate the plugin
  const plugin = filesystemPlugin({});

  // and read from filesystem
  const response' = await plugin.readFile(
    { path: sampleFilePath, },
    client
  );
});

For more usage examples see src/__tests__.

API

  • readFile
  • readFileAsString
  • writeFile
  • exists
  • mkdir
  • rm
  • rmdir
0.9.7

1 year ago

0.9.6

1 year ago

0.9.5

1 year ago

0.10.0-pre.7

1 year ago

0.10.0-pre.6

1 year ago

0.10.0-pre.3

1 year ago

0.10.0-pre.4

1 year ago

0.10.0-pre.1

1 year ago

0.10.0-pre.5

1 year ago

0.9.4

2 years ago

0.9.3

2 years ago

0.10.0-pre.0

2 years ago

0.9.0

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.8.0

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago