@muze-nl/jsfs-solid
v0.4.0
Published
A filesystem adapter for JSFS that can read/write Solid Storage PODs
Downloads
1,743
Readme
JSFS-Solid: a jsfs solid client
import '@muze-nl/jsfs-solid'
const client = solidClient(
"https://auke.solidcommunity.net/",
"/public/",
{
client_info: {
client_name: 'My Client'
}
}
)
async function main() {
const dir = await client.list()
console.log(dir)
}
main()Table of Contents
Introduction
JSFS-Solid is both a client to access Solid PODs (storage) and an Adapter for the JSFS API.
Usage
npm install @muze-nl/jsfs-solidIn the browser, using a cdn:
<script src="https://cdn.jsdelivr.net/npm/@muze-nl/jsfs-solid/dist/browser.js"></script>Using ES6 modules, in the browser (using a bundler) or Node (or Deno, or...):
import '@muze-nl/jsfs-solid'Create a new client like this:
const client = solidClient(
'https://auke.solidcommunity.net/',
'/public/',
{
client_info: {
client_name: "My Client"
}
}
)This client implements a simple filesystem API with the following methods:
cdreadwritedeleteexistslist
The list method returns an array of objects with these properties:
{
filename,
path,
name
}The read method returns these properties, where data is a dataset using OLDM.
{
type,
name,
contents,
data,
http: {
headers,
status,
url
}
}Similarly, you can write files like this:
await client.write(data, 'movies.ttl', 'text/turtle')Just make sure that the data is OLDM data.
Dependencies
License
This software is licensed under MIT open source license. See the License file.
