Get unlimited public & private packages + package-based permissions with npm Pro.Get started »


1.2.14 • Public • Published

Ownfiles - A library for handling files in Solid Pods

The Solid project allows people to use apps on the Web while keeping ownership of their data and choosing where to store it.
Ownfiles is intended to help with file operations on resources saved with Solid.

Table of Contents

  1. Installing
  2. Methods
  3. Contributing


Currently ownfiles is only available as an npm package: npm install ownfiles
The library is intended for browser usage, to use it in a node environment you'll need to add a credentials file as described in Authenticating

To get started you need to import and instantiate the fileClient with either a WebId or the root url of an existing pod:

import FileClient from 'ownfiles';
const fileClient = new FileClient({podUrl: ""}); // alternative to {webId: ""}



The same operation on a folder will return a folder object that holds the contents:

const url = ""; => {
  // do something with the content of the file
const url = ""; => {
  // both will default to an empty array


Deleting a folder is indifferent from a file since both promises return nothing. However for deleting folders you'll need to make sure the folder url ends with a slash.

const url = "";
fileClient.delete(url).then(() => {
  console.log("Successfully deleted");
  // At this point the file would be deleted


To create a file with some payload you'll need to pass the payload, with the content type into the optional options parameter as a string:

const someContent = "Hello World!";
const url = "";
fileClient.create(url, {contents: someContent, contentType: "text/plain"}).then(() => {
  console.log("Successfully created");
  // At this point the file would be successfully created

One also has the ability to pass triples as a payload:

const someTriples = store.each();
const url = "";
fileClient.create(url, {contents: someTriples}).then(() => {

Creating a folder doesn't require any additional params, just the url, which, again, should end with a slash.


To copy a resource you'll need to pass the file or folder to copy, and the location to copy it to:

const file = "";
const newLocation = ""
fileClient.create(file, newLocation).then(() => {


To rename a folder or a file you'll need to pass the resource-url and the new name to the respective function:

const file = "";
const newName = "helloWorld"
fileClient.renameFile(file, newName).then(() => {

for folders:

const file = "";
const newName = "photos-of-friends"
fileClient.renameFolder(file, newName).then(() => {


In general contributions are very welcome, feel free to work on and open pull requests in regards to issues/optimizations you see. Please write a test or use an existing test in your development process, so that we can make sure your contribution integrates smoothly.


To test this library we decided on using mocha and chai. To run the tests simply run npm run test

Since the operations are all asynchronous it can come to complications between the tests (we're working on that), so to test singularly run: node_modules/mocha/bin/mocha name_of_test.test.js


To authenticate you'll need to install the solid-auth-cli npm package.
Then Create a credentials file in your home directory called ~/.solid-auth-cli-config.json with the following fields:

  "username": USERNAME,
  "password": PASSWORD


npm i ownfiles

DownloadsWeekly Downloads






Unpacked Size

448 kB

Total Files


Last publish


  • avatar