{"id":13628175,"url":"https://github.com/jeff-zucker/solid-file-client","last_synced_at":"2025-08-21T08:31:23.199Z","repository":{"id":33960249,"uuid":"156475530","full_name":"jeff-zucker/solid-file-client","owner":"jeff-zucker","description":"A Javascript library for creating and managing files and folders in Solid data stores","archived":false,"fork":false,"pushed_at":"2024-03-19T20:57:32.000Z","size":5205,"stargazers_count":55,"open_issues_count":39,"forks_count":18,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-12-09T07:42:40.664Z","etag":null,"topics":["linked-data-platform","solid"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeff-zucker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-07T01:55:45.000Z","updated_at":"2024-08-04T10:22:12.000Z","dependencies_parsed_at":"2024-03-19T21:51:00.831Z","dependency_job_id":"2af0336f-e773-436b-b9cf-d66030c282cf","html_url":"https://github.com/jeff-zucker/solid-file-client","commit_stats":{"total_commits":431,"total_committers":11,"mean_commits":39.18181818181818,"dds":0.4245939675174014,"last_synced_commit":"c38641b37c9df6f3082262a4b1d13e61be6d1445"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeff-zucker%2Fsolid-file-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeff-zucker%2Fsolid-file-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeff-zucker%2Fsolid-file-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeff-zucker%2Fsolid-file-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeff-zucker","download_url":"https://codeload.github.com/jeff-zucker/solid-file-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230501172,"owners_count":18236061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linked-data-platform","solid"],"created_at":"2024-08-01T22:00:47.613Z","updated_at":"2024-12-19T21:10:10.945Z","avatar_url":"https://github.com/jeff-zucker.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Solid-File-Client\n\nA library for managing Solid files and folders.\n\ncurrent version : \u003ca href=\"http://badge.fury.io/js/solid-file-client\"\u003e![npm](https://img.shields.io/npm/v/solid-file-client)\u003c/a\u003e\n\u003cbr\u003e\nprevious version : \u003ca href=\"https://www.npmjs.com/package/solid-file-client/v/0.5.3\"\u003e\u003cimg src=\"https://img.shields.io/badge/npm%20package-0.5.3-brightgreen.svg\"\u003e\u003c/a\u003e\n\n\u003cb\u003eTable of Contents\u003c/b\u003e : \u003ca href=\"#introduction\"\u003eIntroduction\u003c/a\u003e |\n\u003ca href=\"#installing\"\u003eInstalling\u003c/a\u003e |\n\u003ca href=\"#importing\"\u003eImporting, Invoking, Logging In\u003c/a\u003e |\n\u003ca href=\"#error-handling\"\u003eError Handling\u003c/a\u003e |\n\u003ca href=\"#high-level-methods\"\u003eHigh Level Methods\u003c/a\u003e |\n\u003ca href=\"#advanced-options\"\u003eAdvanced Options\u003c/a\u003e |\n\u003ca href=\"#low-level-methods\"\u003eLow-level Methods\u003c/a\u003e |\n\u003ca href=\"#ACL management\"\u003eACL management\u003c/a\u003e |\n\u003ca href=\"#Solid RDF utilities\"\u003eSolid RDF utilities\u003c/a\u003e |\n\u003ca href=\"#terminology\"\u003eNote on Terminology\u003c/a\u003e |\n\u003ca href=\"#acknowledgements\"\u003eAcknowledgements\u003c/a\u003e\n\n## Introduction\n\nSolid-File-Client is a JavaScript library with high-level methods to create, read, and manage files and folders.  The methods may be used in browser scripts or in nodejs shell scripts.  The library supports both text and binary files and can read and write data from Solid Pods, from local file systems, and from virtual in-memory storage.  It can also recursively move and copy entire folder trees between any of those storage locations. For advanced users, there are also a number of options and lower-level methods which allow fine-tuned control over linked resources and other features of Solid. \n\n### Note for users of version 0.x of Solid-File-Client\n\nThere are a number of changes which are not backward compatible.  See [Guide for transitioning to v.1](docs/transition-to-v.1.md) for details and hints for upgrading.\n\n### Using alternate storage spaces\n\nSolid-file-client can work with web resources (https://).  It can also work\nwith resources stored in a browser's local storage (app://), or a local file system (file://).  See the [Upload Demo](https://jeff-zucker.github.io/solid-file-client/docs/examples/) for an example of copying files from a local filesystem to a pod in the browser and [Node Upload Demo](docs/node-upload.md) for the same thing in node.  See [Solid-Rest](https://github.com/jeff-zucker/solid-rest) for a description of using browser local storage or accessing the local file system from node scripts.\n\nIn node, the copyFile() and copyFolder() commands can upload files from a local file system to a remote pod and vice-versa:\n\nTo upload\n```javascript\n   await fc.copyFolder( \"file:///somepath/foo/\", \"https://somehost/somepath/foo/\" )\n```\nTo download\n```javascript\n   await fc.copyFolder( \"https://somehost/somepath/foo/\", \"file:///somepath/foo/\", \n```\n\n### Using with front-ends\n\nSeveral front-ends for Solid-File-Client have been built.  In a browser you can use the [Solid-IDE](https://github.com/jeff-zucker/solid-ide) GUI or create your own GUI using [Solid-File-Widget](https://github.com/bourgeoa/solid-file-widget) or any GUI framework such as React or Vue.  In node or from the command line, you can use [Solid-Shell](https://github.com/jeff-zucker/solid-shell), an interactive shell, batch-processor, and command-line front-end for Solid-File-Client. \n\n### Overview of writing methods\n\nBy default, all high-level methods that create, copy, or move files or folders have these behaviors :\n\n  * the source always completely overwrites the target\n  * if the path to the item doesn't pre-exist, it will be created\n  * linked files (.acl and .meta) are copied/moved along with their resources\n\nFor many purposes, these defaults will suffice.  However, if you need to, you may change any of them with option flags.  There are several options for merging folder trees as well as for using Solid's POST features. See the sections on [Overwriting](#overwriting), on [Creating Paths](#creating-paths), and on [Linked Files](#linked-files) for more information.\n\n### Demo scripts\n\nSee the [Upload \u0026 Copy Demos](https://jeff-zucker.github.io/solid-file-client/docs/examples/) for working examples.\n\n## \u003ca name=\"Installing\"\u003eInstalling\u003c/a\u003e\n\nIf you are writing scripts only for the browser, you may wish to use a CDN code repository rather than using a local version. See [here](docs/using-in-browser.md) for an example of using a CDN.\n\nIf you are writing scripts for node or you want a local version, install using \nnpm\n```\n    npm install solid-file-client\n    change to the solid-file-client folder\n    npm install   // this pulls in dependencies\n    npm run build // this creates the executables\n```\nOnce installed the executables will be found within the solid-file-client folder :\n```\n    dist/node/solid-file-client.bundle.js      // for node scripts\n    dist/window/solid-file-client.bundle.js   // for browser scripts\n```\nYou can also clone or fork the github repository if wish.\n\n## \u003ca name=\"importing\"\u003eImporting, invoking, and logging-in\u003c/a\u003e\n\nHere is the general process for a script using Solid-File-Client :\n\n* Import the solid-file-client and solid-auth-cli(ent) libraries\n* Instantiate an auth object\n* Instantiate a file-client object using the auth object\n* Use the auth object to login and for session management\n* Use the file-client object to read and write files and folders\n\nHere is a short node script illustrating the process.\n```javascript\n    const auth = require('solid-auth-cli')\n    const FC   = require('solid-file-client')\n    const fc   = new FC( auth )\n    async function run(){\n        let session = await auth.currentSession()\n        if (!session) { session = await auth.login() }\n        console.log(`Logged in as ${session.webId}.`)\n        if( await fc.itemExists( someUrl ) {\n            let content = await fc.readFile( someUrl )\n            // ... other file methods\n            // ... and/or other auth methods\n        }\n    }\n    run()\n```\nSee [Using with Node](docs/using-with-node.md) for details of logging\nin with node and command line scripts.  See [Using in a Browser](docs/using-in-browser.md) for a detailed example of importing, invoking, and logging in from a browser script.\n\nFor more information on auth and session functions see [solid-auth-client](https://github.com/solid/solid-auth-client) for the browser and [solid-auth-cli](https://github.com/jeff-zucker/solid-auth-cli) for node.\n\n## \u003ca name=\"error-handling\"\u003eError Handling\u003c/a\u003e\n\nAll Solid-File-Client methods should throw an error if they do not succeed.\nTo trap and examine errors, use try/catch:\n```javascript\n    fc.readFile(url).then((content) =\u003e {\n        console.log(content)\n    })\n    .catch(err =\u003e console.error(`Error: ${err}`))\n```\nOr, in an async method :\n```javascript\n    try {\n        let content = await fc.readFile( someUrl )\n        console.log(content)\n    }\n    catch(error) {\n        console.log( error )         // A full error response \n        console.log( error.status )  // Just the status code of the error\n        console.log( error.message ) // Just the status code and statusText\n    }\n```\nSee [Interpreting Error Responses](docs/error-handling.md) for further options and a\ndescription of errors for recursive methods like copyFolder().\n\n## \u003ca name=\"high-level-methods\"\u003eHigh-level Methods\u003c/a\u003e\n\n### createFile( fileURL, content, contentType, options )\n### postFile( fileURL, content, contentType, options )\n\nCreates a new file at the specified URL.  Content is required, even if only a blank string.  ContentType should be something like \"text/turtle\" or \"image/png\" and is required. \n\nDefault behavior :\n  * If a file already exists at that URL, it will be overwritten.\n  * If the file's parent path does not exist, it will be created.\n\nSee [Overwriting](#overwriting) and [Creating Paths](#creating-paths) if you need to change the default behavior.\n\nNote for all: Previous versions of of Solid Server tried to guess the content-type from the file extension but you should not depend on this behavior.  Previous versions would sometimes add an extension e.g. if you created a file named \"foo\" with type \"text/turtle\", it would be renamed \"foo.ttl\".  This is no longer the case, the file will be named \"foo\" and will still have the type \"text/turtle\".\n\nNote for advanced users : This method uses PUT, if you prefer the behavior of \nPOST (for example creating alternate versions of a resource rather than replacing it) use the **postFile()** method, which takes the same parameters as createFile().\n\n### patchFile( fileUrl, patchContent, patchContentType )\n\nModifies the content of fileUrl adding or removing triples.\n\n`fileUrl` is parsed with N3.js ('text/turtle' files and others)\n\npatchContentType is either 'text/n3' or 'application/sparl-update'\n\n- 'text/n3' patchContent can use `inserts`, `deletes` and `where`. N3 notation is a turtle content with graph objects.\n```\n    @prefix solid: \u003chttp://www.w3.org/ns/solid/terms#\u003e.\n    @prefix : \u003c#\u003e.\n    @prefix ex: \u003chttp://example.com#\u003e.\n    \u003c\u003e solid:patches \u003cfileUrl\u003e;\n          solid:deletes { \u003c\u003e a :test. };\n          solid:inserts { \u003c#new\u003e ex:temp :321; ex:temp1 :200, :300. }.\n```\nif triples `\u003c#new\u003e ex:temp1 :250 exists`. The `solid:inserts` clause can be expressed as :\n```\n          solid:where { ?a ex:temp1 :250. };\n          solid:inserts { ?a ex:temp :321; ex:temp1 :200, :300. }.\n```\n- 'application/sparql-update' patchContent can only use sparql `INSERT` and `DELETE`. Turtle notation is used for prefix and triples.\n```\n    @prefix ex: \u003chttp://example.com#\u003e.\n    INSERT { \u003c#new\u003e ex:temp :321; ex:temp1 :200, :300 .}\n    DELETE { \u003c\u003e a :test. }\n```\n**Nota** on needed acl auth to patch `fileUrl` : \n\n. with insert `Append` or `Write`,\n\n. and with delete `Write`.\n\n### \u003ca name=\"createFolder\"\u003ecreateFolder( folderURL, options )\u003c/a\u003e\n\nCreates a new folder at the specified URL.  \n\nDefault behavior :\n  * If a folder already exists at that URL, it will be overwritten and all of its contents lost.\n  * If the folder's parent path does not exist, it will be created.\n\nSee [Overwriting](#overwriting) and [Creating Paths](#creating-paths) to change the default behavior.\n\n\n### readFile( fileURL, options )\n\nOn success, the readFile() method returns the contents of the specified file.\nThe return value will be a string for text files and a blob for binary files\nsuch as images and music.  \n\nAdvanced users : If you want the content as a ReadableStream, or you need to specify an accept header, use the get() or fetch() methods - see [Low-level Methods](#low-level-methods).\n\n### readFolder( folderURL, options )\n\nOn success, the readFolder() method returns a folder object in this format:\n```javascript\n{\n     type : \"folder\",\n     name : // folder name (without path),\n      url : // full URL of the resource,\n modified : // dcterms:modified date\n    mtime : // stat:mtime\n     size : // stat:size\n   parent : // parentFolder or undef if none\n    files : // an array of files in the folder\n  folders : // an array of sub-folders in the folder\n    links : // an array of links for the folder itself IF links=include specified\n}\n```\nEach item in the arrays of files and sub-folders will be a file object which is the same as a folder object except it does not have the last two fields (files,folders). The content-type in this case is not guessed, it is read from the folder's triples, i.e. what the server sends.\n\nBy default, readFolder() does not list linked resources (.acl and .meta files).  To change this behavior, see [Linked files](#linked-files).\n\n### readHead( folderOrFileURL, options ), head( folderOrFileURL, options )\n\nThe readHead() method returns all the headers for an item as a string. It is the equivalent of curl -I.\n```javascript\n    console.log( await fc.readHead(url) ) // prints all headers\n``` \nThe head() method returns a standard header response which you may inspect useing the headers.get() method.\n```javascript\n    let response = await fc.head( url )\n    let contentType = response.headers.get('content-type')\n``` \n\n### \u003ca name=\"itemExists\"\u003eitemExists( fileOrFolderURL )\u003c/a\u003e\n\nReturns true if the URL exists and false otherwise.\n\n### deleteFile( fileURL, options )\n\nDeletes the specified file and all linked filed (.acl,.meta)\n\n### deleteFolder( folderURL )\n\nRecursively deletes a folder and all of its contents including all linked files (.acl, .meta).\n\n### moveFile( sourceURL, targetURL, options ), copyFile( sourceURL, targetURL, options )\n\nCopies or moves the specified source to the target.\n\nDefaults :\n  * If a file already exists at that target, it will be overwritten.\n  * If the target URL's parent path does not exist, it will be created.\n  * Linked files (.acl and .meta) will be copied if they exist.\n\nSee [Advanced Options](#advanced-options) to modify these default behaviors.\n\n### moveFolder(sourceURL,targetURL,options), copyFolder(sourceURL,targetURL,options)\n\nRecursively copies or moves a folder and all of its contents.\n\nDefaults :\n  * If the target exists, it is replaced by the source.\n  * If the top target folder's parent path does not exist, it will be created.\n  * Linked files (.acl and .meta) will be copied/moved if they exist.\n\nThese default behaviors may all be modified.  For example, you can choose from several ways to merge the source and target folders.  See [Advanced Options](#advanced-options) for more details.\n\n\n### createZipArchive(sourceURL, archiveURL, options), extractZipArchive(archiveURL, targetFolderURL, options)\n\nZip folder/file and Unzip file.\n\nDefaults :\n\n  * zip/unzip : Linked files (.acl and .meta) will be ziped/unziped if they exist.\n  * unzip\n\n        * TargetFolderURL is where the archive file is unzipped\n        * if unzipped root file or root folder exist they shall be overwritten\n        * .acl are checked for validity (notably for acl:Control by at least one agent type (agent, agentClass, agentGroup))\n\nThese default behaviors may all be modified.  For example, you can choose from several ways to unzip the archiveURL, or check for .acl validity.  See [Advanced Options](#advanced-options) for more details.\n\n## \u003ca name=\"advanced-options\"\u003eAdvanced Options\u003c/a\u003e\n\n### \u003ca name=\"overwriting\"\u003eOverwriting\u003c/a\u003e\n\nBy default, methods which create, copy, or move files or folders will overwrite an item of the same name in the target space, replacing it with the source item.  This behavior may be modified in several ways\n\nWith any of the create/copy/move methods, you can use the [itemExists()](#itemExists) method to prevent overwriting items.\n```javascript\n    if( !(await fc.itemExists(x)) ) {\n        await fc.createFolder(x) // only create if it doesn't already exist\n    }\n ```\nWith the **copyFolder()** and **moveFolder()** methods, you can elect to merge the source and target with preference for the source or preference for the target:\n \n   * **default** - target is replaced by source\n   * **merge=keep_source** - target becomes source plus items found only in target \n   * **merge=keep_target** - target becomes target plus items found only in source\n\nFor example :\n```javascript\n    await copyFolder( source, target, {merge:\"keep_source\"} )\n```\nTo avoid typos, you may also import the constants for these options:\n```javascript\n    const { MERGE } = SolidFileClient\n    await copyFolder( source, target, {merge: MERGE.KEEP_SOURCE } )\n```\n### \u003ca name=\"creating-paths\"\u003eCreating Paths\u003c/a\u003e\n\nWhen you create a file or folder and the path to that item doesn't already exist, Solid-File-Client will create the path for you if it can.  For example, if you ask to create /foo/bar/baz.txt but there is no /foo/ folder and there is no /bar/ folder, Solid-File-Client will create /foo/ and then create /bar/ inside it and then create baz.txt inside that.\n\nIf you would rather the program fails if the path you asked for doesn't exist, you may set the \"createPath\" flag to false.\n\n  * **createFile(),createFolder(),copyFile(),copyFolder(),moveFile(),moveFolder()**\n  \n      * **default** - create intermediary paths if they are missing\n      * **createPath=false** - fail if intermediary paths are missing\n      \n  * **note** for copyFolder() and moveFolder(), the createPath option applies only to the top-level target folder, not to folders within the target which are handled by the merge option      \n\nFor example:\n```javascript\n      await createFile( url, {createPath:false} )\n```\n\n### \u003ca name=\"linked-files\"\u003eLinked Files\u003c/a\u003e\n\nOne of Solid's unique features is the use of linked files.  Currently the two\nmain types of linked files are .acl files which control access to the main\nfile they are linked from and .meta files which describe additional features\nof the file they are linked from.  Solid-file-client, by default treats these\nlinked files as tightly bound to the resource they are referencing.  In other\nwords when you delete, move, or copy a file that has linked files, the linked\nfiles will also be deleted, moved, or copied.  These defaults should be\nsufficient for most basic usage.  \n\nAdvanced users can modify how linked files are handled with the withAcl, withMeta, agent, and links option flags shown below.\n\n  * **copyFile(),copyFolder(),moveFile(),moveFolder()**\n\n      * **default**        - .acl and .meta items are copied/moved, acl is modified\n      * **withAcl=false**   - .acl items are not copied/moved\n      * **withMeta=false**  - .meta items are not copied/moved\n\nSolid servers provide the possible location of linked resources in the headers of all resources.  Solid-file-client supports the links=include_possible option to include these possible locations without checking to see if the linked file actually exists. The possible locations tell you where to create the linked file if they don't already exist.\n\n  *  **readFolder()**\n\n      * **default**                - linked items are not listed\n      * **links=include**          - linked items are listed, when they exist\n      * **links=include_possible** - possible locations of links are listed\n\nFor example:\n```javascript\n      await copyFile( source, target, {links:\"exclude\"} )\n      await readFolder( url, {links:\"include_possible\"} )\n```\nTo avoid typos, you may also import the constants for the link options:\n```javascript\n    const { LINKS } = SolidFileClient\n    await copyFolder( source, target, {links: LINKS.INCLUDE_POSSIBLE} )\n```\nWith readFolder()'s links:include and links:include_possible option flags, the links for the folder are a property of the folder object and the links for contained resources are in the file objects.  For example:\n```javascript\n      let folder = await readFolder( url, {links:\"include\"} )\n      console.log(folder.links.meta || \"no .meta for this folder\")\n      console.log(folder.files[0].links.acl) || \"no .acl for this file\")\n```\nSee also, the **getItemLinks()** method which finds the possible locations of linked resources for an item.  See [Low-level Methods](#low-level-methods)\n\nSolid-file-client makes a special case for access control (.acl) files.  These\nfiles may contain absolute links which will no longer work when the file is \ncopied or moved.  **You should avoid using absolute links in .acl files.**  If you do use absolute links in your accessTo field, Solid-File-Client will always modify the .acl file to make the accessTo field relative to the new location.  If you use absolute links for the agent field, that could change the owner of the copied or moved resource.  You may control this aspect of modifying the .acl file through the agent flag as shown below.\n\n  * **copyFile(),copyFolder(),moveFile(),moveFolder()**\n\n      * **default**        - accessTo is made relative, agent, untouched\n      * **agent=to_source**   - accessTo is made relative, agent made absolute to source\n      * **agent=to_target**   - accessTo is made relative, agent made relative to target\n\n## \u003ca name=\"low-level-methods\"\u003eLow-level methods\u003c/a\u003e\n\nSolid-File-Client provides a number of low-level methods which either support advanced options or directly reflect the behavior of the Solid server without additional processes as are found in the high-level methods.  \n\nSee the [JSdoc for the API](docs/JSdoc/api.md) for more details of these methods.\n\n## \u003ca name=\"ACL management\"\u003eACL management\u003c/a\u003e\n\nACL management functions have been implemented to support creation of ACL files. (with createFile() or putFile())\nIt allows to create/edit programmatically the ACL content using an intermediate ACL object : \n\n```javascript\n-let aclObject = await fc.aclUrlParser(url) // returns an acl object from the acl inheritance algorithm for the url.\n- let aclObject = await fc.acl.contentParser(url, aclContent) // returns an aclObject from an acl file Content\n- let aclContent = await fc.acl.createContent(url, aclObject, options) /// build acl content from an aclObject for url\n- let aclObject = await fc.acl.addUserMode(aclObject, userAgent, userMode, userAccess) // add user, mode and access to an aclObject\n- let aclObject = await fc.acl.deleteUserMode(aclobject, userAgent, userMode, userAccess) // delete user,mode and/or access from an aclObject\n```\n\nexample 1 :\n```javascript\n// create aclContent with the inheritance algorithm (url is not the link url)\nlet content = await fc.aclUrlParser(url)\n  .then(agents =\u003e fc.acl.createContent(url, agents))\n```\nexample 2 :\n```javascript\n// create a block rule\nlet aclUsers = await fc.acl.addUserMode({}, [{ agentClass: 'Agent' }], ['Read'])\n// add an other rule in the block rule\naclUsers = await fc.acl.addUserMode(aclUsers, [{ agent: 'https://example.solidcommunity.net/profile/card#me' }], ['Read', 'Write', 'Control'], ['accessTo'])\n\n// build the aclContent\nconst aclBloks = [aclUsers] // array of block rules\nconst aclContent = await fc.acl.createContent('https://example.solidcommunity.net/public/text.txt', aclBloks)\nconsole.log('build an aclContent ' + aclContent)\n\n\n@prefix : \u003c#\u003e.\n@prefix n0: \u003chttp://www.w3.org/ns/auth/acl#\u003e.\n@prefix n1: \u003chttp://xmlns.com/foaf/0.1/\u003e.\n@prefix target: \u003ctext.txt\u003e.\n\n:Read\n    a n0:Authorization;\n    n0:accessTo target:;\n    n0:agentClass n1:Agent;\n    n0:mode n0:Read.\n\n:ReadWriteControl\n    a n0:Authorization;\n    n0:accessTo target:;\n    n0:agent \u003c/profile/card#me\u003e;\n    n0:mode n0:Read, n0:Write, n0:Control.\n\n```\nto create an acl resource for a resource url :\n```javascript\n    const { acl: aclUrl } = await fc.getItemLinks(url, { links: 'include_possible'})\n    return await fc.putFile(aclUrl, aclContent, 'text/turtle')\n\n```\n**Nota** :\n\nconst aclModes = ['Read', 'Append', 'Write', 'Control']\n\nconst aclPredicates = ['agent', 'agentClass', 'agentGroup', 'origin']\n\nconst aclAccess = ['accessTo', 'default']\n\n- userAgent : an array of objects (predicate: object). example: [{ agent: 'https://example.com/profile/card#me'}, { agentClass: 'Agent' }, { origin: 'https://solidcommunity.net' }, { default: '' }]\n- userMode : an array of acl modes. example: ['Read', 'Write']. To be applied to each element of userAgent\n- userAccess : an array of acl access. example : ['accessTo', 'default']\n   \n   Default is only used in the container acl. Only needed if a subset of rules are inherited.\n\n**Remark** :  among other functions, are available\n- an ACL check function : await acl.isValidAcl (itemUrl, aclContent, options)\n- and an ACL make relative : acl.makeContentRelative (aclcontent, itemUrl, toName, options)\n\nSee the [JSdoc for the aclParser](docs/JSdoc/aclParser.md) for more details on these methods.\n\n## \u003ca name=\"Solid RDF utilities\"\u003eSolid RDF utilities\u003c/a\u003e\n\nA minimal class to query, edit and write rdf files content in/from N3 store using solid-namespace.\n\n`query(url, s, p, o, g)`\n   * loads a Turtle file, parses it, returns an array of quads\n   * expects URL of a source file, if empty, uses previously loaded file\n   * expects Turtle strings or null for subject, predicate, object, \u0026 optional graph\n   * supports this non-standard syntax for Turtle strings -\n     - {somePrefix:someTerm}\n       somePrefix is then replaced using URLs from solid-namespace\n       the special prefix thisDoc {thisDoc:me} uses current doc as namespace\n     - N3 quad subject, predicate, object and optional graph\n\n\nExamples :\n\n write store relative to baseIRI : `const content = fc.$rdf.write(url, { baseIRI: url })`\n\n get quads from ttlContent : `const quads = fc.$rdf.queryTurtle(url, ttlContent, null, { acl: 'mode'}, { acl: 'Control' })`\n\n\nSee the [JSdoc for the rdf-query](docs/JSdoc/rdf-query.md) for more details on these methods.\n\n## \u003ca name=\"terminology\"\u003eNote on terminology\u003c/a\u003e\n\nSolid servers can store data directly in a physical file system,  or use a database or other storage.  Instead of talking about \"Files\" and \"Folders\", it is more correct to talk about \"Containers\" and \"Resources\" - logical terms independent of the storage mechanism.  In this documentation, for simplicity, we've used the file/folder terminology with no implication that it represents a physical file system.\n\n\n## \u003ca name=\"acknowledgements\"\u003eAcknowledgements\u003c/a\u003e\n\n\nThis library was originally authored by **\u003ca href=\"https://github.com/jeff-zucker\"\u003eJeff Zucker\u003c/a\u003e**. Version 1.0.0 includes many additions and improvements that were the results of a collaboration between Jeff, **\u003ca href=\"https://github.com/bourgeoa\"\u003eAlain Bourgeois\u003c/a\u003e**, and **\u003ca href=\"https://github.com/Otto-AA\"\u003eOtto AA\u003c/a\u003e**.\n\nMany thanks for patches and issues from https://github.com/linonetwo, and https://github.com/scenaristeur.\n\ncopyright (c) 2018 Jeff Zucker may be freely used with MIT license\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeff-zucker%2Fsolid-file-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeff-zucker%2Fsolid-file-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeff-zucker%2Fsolid-file-client/lists"}