Solid-Node-Client 2.0.1 is now available. This library provides nodejs access to NSS-style and ESS-style Solid Pods and to your local file system and cloud storage backends treated as serverless pods.
The library may be used stand-alone, or may be combined with other libraries such as rdflib or solid-file-client . See details in the README and examples in the examples folder.
You can install from npm or download/clone the repo.
Here’s an example usage :
/* fetch & display a public resource
then login, fetch & display a private resource
*/
import { SolidNodeClient } from 'solid-node-client';
const client = new SolidNodeClient();
async function test(){
let response = await client.fetch('https://example.com/publicResource');
console.log(await response.text());
let session = await client.login( getCredentials() );
if( session.isLoggedIn ) {
console.log (`logged in as <${session.webId}>`);
response = await client.fetch('https://example.com/privateResource');
console.log(await response.text())
}
}