README
About
An implementation of LinkedPipes Applications Storage. The package adds functionality to interact with SOLID PODs and is intented to be used with LinkedPipes Applications Platform. However, some generic abstractions can be expanded for more generic use-cases.
Prerequisited
Aside from local prerequisited, the software is intented to be used along with a web server implementing SOLID project requirements. The framework was actively tested with an instance of node-solid-server.
Installation
Using yarn
:
yarn add linkedpipes-storage
Using npm
:
npm install linkedpipes-storage
Quick start
The generic examples below demonstrate the usage of StorageFileManager
abstraction. For more detailed examples and TypeScript documentation refer here.
ResourceConfig
1. Creating The ResourceConfig
is a class describing your resource inside SOLID POD. In this example let's define a single resource configuration class instance for a folder to be created in a POD:
import { ResourceConfig, SolidResourceType } from './storage-manager';
const folderConfigurationResource: ResourceConfig = new ResourceConfig(
{
path: `https://{your_username}.inrupt.net`,
title: `${your_title}.txt`,
type: SolidResourceType.Folder
},
{your_web_id}
);
2. Creating, editing, deleting resource
After defining the ResourceConfig
instance, let's create one:
import { StorageFileManager } from './storage-manager';
const result = await StorageFileManager.createResource(fileConfigurationResource);
Renaming folder
const folderConfigurationResourceRenamed: ResourceConfig = new ResourceConfig(
{
path: fileConfigurationResource.resource.path,
title: fileConfigurationResource.resource.title + '_renamed',
type: fileConfigurationResource.resource.type
},
fileConfigurationResource.webID
); // Defines a sample renamed resource
const result = await StorageFileManager.renameResource(folderConfigurationResource, folderConfigurationResourceRenamed);
Deleting folder
const result = await StorageFileManager.deleteResource(folderConfigurationResourceRenamed);
Testing
Testing is performed using ava.js and istanbul.js frameworks.
Executing tests is performed as follows:
yarn test