## Classes
SolidAPI
SolidFileClient ⇐ SolidApi

Class for working with files on Solid Pods

## Typedefs
WriteOptions : object
ReadFolderOptions : object
SolidApiOptions : object
Links : object
Item : object
FolderData : object
fetch ⇒ Promise.<Response>

(optionally authenticated) fetch method similar to window.fetch

zipOptions : object
unzipOptions : object
SolidFileClientOptions : object
## SolidAPI **Kind**: global class * [SolidAPI](#SolidAPI) * [new SolidAPI(fetch, [options])](#new_SolidAPI_new) * [.fetch(url, [options])](#SolidAPI+fetch) ⇒ Promise.<Response> * [.get(url, [options])](#SolidAPI+get) ⇒ Promise.<Response> * [.delete(url, [options])](#SolidAPI+delete) ⇒ Promise.<Response> * [.post(url, [options])](#SolidAPI+post) ⇒ Promise.<Response> * [.put(url, [options])](#SolidAPI+put) ⇒ Promise.<Response> * [.patch(url, [options])](#SolidAPI+patch) ⇒ Promise.<Response> * [.head(url, [options])](#SolidAPI+head) ⇒ Promise.<Response> * [.options(url, [options])](#SolidAPI+options) ⇒ Promise.<Response> * [.itemExists(url)](#SolidAPI+itemExists) ⇒ Promise.<boolean> * [.postItem(url, content, contentType, link, [options])](#SolidAPI+postItem) ⇒ Promise.<Response> * [.createFolder(url, [options])](#SolidAPI+createFolder) ⇒ Promise.<Response> * [.postFile(url, content, [options])](#SolidAPI+postFile) ⇒ Promise.<Response> * [.createFile(url, content, [options])](#SolidAPI+createFile) ⇒ Promise.<Response> * [.putFile(url, content, [options])](#SolidAPI+putFile) ⇒ Promise.<Response> * [.patchFile(url, patchContent, patchContentType)](#SolidAPI+patchFile) ⇒ Promise.<Response> * [.readFolder(url, [options])](#SolidAPI+readFolder) ⇒ [Promise.<FolderData>](#FolderData) * [.getItemLinks(url, [options])](#SolidAPI+getItemLinks) ⇒ [Promise.<Links>](#Links) * [.copyFile(from, to, [options])](#SolidAPI+copyFile) ⇒ Promise.<Response> * [.copyMetaFileForItem(oldTargetFile, newTargetFile, [options])](#SolidAPI+copyMetaFileForItem) ⇒ Promise.<(Response\|undefined)> * [.copyAclFileForItem(oldTargetFile, newTargetFile, [options])](#SolidAPI+copyAclFileForItem) ⇒ Promise.<Response> * [.copyLinksForItem(oldTargetFile, newTargetFile, [options])](#SolidAPI+copyLinksForItem) ⇒ Promise.<Array.<Response>> * [.copyFolder(from, to, [options])](#SolidAPI+copyFolder) ⇒ Promise.<Array.<Response>> * [.copy(from, to, [options])](#SolidAPI+copy) ⇒ Promise.<Array.<Response>> * [.deleteFolderContents(url)](#SolidAPI+deleteFolderContents) ⇒ Promise.<Array.<Response>> * [.deleteFolderRecursively(url)](#SolidAPI+deleteFolderRecursively) ⇒ Promise.<Array.<Response>> * [.move(from, to, [copyOptions])](#SolidAPI+move) ⇒ Promise.<Array.<Response>> * [.rename(url, newName, [moveOptions])](#SolidAPI+rename) ⇒ Promise.<Array.<Response>> ### new SolidAPI(fetch, [options]) Provide API methods which use the passed fetch method constructor adds : - this.rdf methods from RdfQuery - this.acl methods from AclParser | Param | Type | | --- | --- | | fetch | [fetch](#fetch) | | [options] | [SolidApiOptions](#SolidApiOptions) | ### solidAPI.fetch(url, [options]) ⇒ Promise.<Response> Fetch a resource with the passed fetch method **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Response> - resolves if response.ok is true, else rejects the response | Param | Type | | --- | --- | | url | string | | [options] | RequestInit | ### solidAPI.get(url, [options]) ⇒ Promise.<Response> Send get request **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | [options] | RequestInit | ### solidAPI.delete(url, [options]) ⇒ Promise.<Response> Send delete request **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | [options] | RequestInit | ### solidAPI.post(url, [options]) ⇒ Promise.<Response> Send post request **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | [options] | RequestInit | ### solidAPI.put(url, [options]) ⇒ Promise.<Response> Send put request **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | [options] | RequestInit | ### solidAPI.patch(url, [options]) ⇒ Promise.<Response> Send patch request **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | [options] | RequestInit | ### solidAPI.head(url, [options]) ⇒ Promise.<Response> Send head request **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | [options] | RequestInit | ### solidAPI.options(url, [options]) ⇒ Promise.<Response> Send options request **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | [options] | RequestInit | ### solidAPI.itemExists(url) ⇒ Promise.<boolean> Check if item exists. Return false if status is 404. If status is 403 (or any other "bad" status) reject. **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | ### solidAPI.postItem(url, content, contentType, link, [options]) ⇒ Promise.<Response> Create an item at target url. Per default it will create the parent folder if it doesn't exist. **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | Description | | --- | --- | --- | | url | string | | | content | Blob \| string | | | contentType | string | | | link | string | header for Container/Resource, see LINK in apiUtils | | [options] | [WriteOptions](#WriteOptions) | only uses createPath option | ### solidAPI.createFolder(url, [options]) ⇒ Promise.<Response> Create a folder if it doesn't exist. Per default it will resolve when the folder already existed **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Response> - Response of HEAD request if it already existed, else of creation request | Param | Type | | --- | --- | | url | string | | [options] | [WriteOptions](#WriteOptions) | ### solidAPI.postFile(url, content, [options]) ⇒ Promise.<Response> Create a new file. **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | content | Blob \| String | | [options] | [WriteOptions](#WriteOptions) | ### solidAPI.createFile(url, content, [options]) ⇒ Promise.<Response> Create a new file. Per default it will overwrite existing files **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | content | Blob \| String | | [options] | [WriteOptions](#WriteOptions) | ### solidAPI.putFile(url, content, [options]) ⇒ Promise.<Response> Create a file using PUT Per default it will overwrite existing files **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | content | Blob \| String | | [options] | [WriteOptions](#WriteOptions) | ### solidAPI.patchFile(url, patchContent, patchContentType) ⇒ Promise.<Response> Update a file using PATCH **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | Description | | --- | --- | --- | | url | string | parsable by N3.js | | patchContent | String | | | patchContentType | string | | **Properties** | Name | Type | Description | | --- | --- | --- | | 'text/n3' | patchContentType | or 'application/sparql-update' | ### solidAPI.readFolder(url, [options]) ⇒ [Promise.<FolderData>](#FolderData) Fetch and parse a folder **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | | --- | --- | | url | string | | [options] | [ReadFolderOptions](#ReadFolderOptions) | ### solidAPI.getItemLinks(url, [options]) ⇒ [Promise.<Links>](#Links) Get acl and meta links of an item **Kind**: instance method of [SolidAPI](#SolidAPI) | Param | Type | Description | | --- | --- | --- | | url | string | | | [options] | object | - specify if links should be checked for existence or not - may select acl or meta only | ### solidAPI.copyFile(from, to, [options]) ⇒ Promise.<Response> Copy a file. Per default overwrite existing files and copy links too. **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Response> - - Response from the new file created | Param | Type | Description | | --- | --- | --- | | from | string | Url where the file currently is | | to | string | Url where it should be copied to | | [options] | [WriteOptions](#WriteOptions) | | ### solidAPI.copyMetaFileForItem(oldTargetFile, newTargetFile, [options]) ⇒ Promise.<(Response\|undefined)> Copy a meta file **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<(Response\|undefined)> - creation response | Param | Type | | --- | --- | | oldTargetFile | string | | newTargetFile | string | | [options] | [WriteOptions](#WriteOptions) | ### solidAPI.copyAclFileForItem(oldTargetFile, newTargetFile, [options]) ⇒ Promise.<Response> Copy an ACL file **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Response> - creation response | Param | Type | Description | | --- | --- | --- | | oldTargetFile | string | Url of the file the acl file targets (e.g. file.ttl for file.ttl.acl) | | newTargetFile | string | Url of the new file targeted (e.g. new-file.ttl for new-file.ttl.acl) | | [options] | [WriteOptions](#WriteOptions) | | ### solidAPI.copyLinksForItem(oldTargetFile, newTargetFile, [options]) ⇒ Promise.<Array.<Response>> Copy links for an item. Use withAcl and withMeta options to specify which links to copy Does not throw if the links don't exist. **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Array.<Response>> - creation responses | Param | Type | Description | | --- | --- | --- | | oldTargetFile | string | Url of the file the acl file targets (e.g. file.ttl for file.ttl.acl) | | newTargetFile | string | Url of the new file targeted (e.g. new-file.ttl for new-file.ttl.acl) | | [options] | [WriteOptions](#WriteOptions) | | ### solidAPI.copyFolder(from, to, [options]) ⇒ Promise.<Array.<Response>> Copy a folder and all contents. Per default existing folders will be deleted before copying and links will be copied. **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Array.<Response>> - Resolves with an array of creation responses. The first one will be the folder specified by "to". The others will be creation responses from the contents in arbitrary order. | Param | Type | | --- | --- | | from | string | | to | string | | [options] | [WriteOptions](#WriteOptions) | ### solidAPI.copy(from, to, [options]) ⇒ Promise.<Array.<Response>> Copy a file (url ending with file name) or folder (url ending with "/"). Per default existing folders will be deleted before copying and links will be copied. **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Array.<Response>> - Resolves with an array of creation responses. The first one will be the folder specified by "to". If it is a folder, the others will be creation responses from the contents in arbitrary order. | Param | Type | | --- | --- | | from | string | | to | string | | [options] | [WriteOptions](#WriteOptions) | ### solidAPI.deleteFolderContents(url) ⇒ Promise.<Array.<Response>> Delete all folders and files inside a folder **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Array.<Response>> - Resolves with a response for each deletion request | Param | Type | | --- | --- | | url | string | ### solidAPI.deleteFolderRecursively(url) ⇒ Promise.<Array.<Response>> Delete a folder, its contents and links recursively **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Array.<Response>> - Resolves with an array of deletion responses. The first one will be the folder specified by "url". The others will be the deletion responses from the contents in arbitrary order | Param | Type | | --- | --- | | url | string | ### solidAPI.move(from, to, [copyOptions]) ⇒ Promise.<Array.<Response>> Move a file (url ending with file name) or folder (url ending with "/"). Shortcut for copying and deleting items **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Array.<Response>> - Responses of the copying | Param | Type | | --- | --- | | from | string | | to | string | | [copyOptions] | [WriteOptions](#WriteOptions) | ### solidAPI.rename(url, newName, [moveOptions]) ⇒ Promise.<Array.<Response>> Rename a file (url ending with file name) or folder (url ending with "/"). Shortcut for moving items within the same directory **Kind**: instance method of [SolidAPI](#SolidAPI) **Returns**: Promise.<Array.<Response>> - Response of the newly created items | Param | Type | | --- | --- | | url | string | | newName | string | | [moveOptions] | RequestOptions | ## SolidFileClient ⇐ SolidApi Class for working with files on Solid Pods **Kind**: global class **Extends**: SolidApi * [SolidFileClient](#SolidFileClient) ⇐ SolidApi * [new SolidFileClient(auth, [options])](#new_SolidFileClient_new) * [.readFile(url, [request])](#SolidFileClient+readFile) ⇒ Promise.<(string\|Blob\|Response)> * [.readHead(url, options)](#SolidFileClient+readHead) ⇒ string * [.deleteFile(url)](#SolidFileClient+deleteFile) ⇒ Promise.<Response> * [.deleteFolder(url)](#SolidFileClient+deleteFolder) ⇒ Promise.<Array.<Response>> * [.aclUrlParser(url)](#SolidFileClient+aclUrlParser) ⇒ object * [.getFolderItemList(path)](#SolidFileClient+getFolderItemList) ⇒ Promise.<Array.<Item>> * [.createZipArchive(resource, archiveUrl, options)](#SolidFileClient+createZipArchive) ⇒ promise.<response> * [.getAsZip()](#SolidFileClient+getAsZip) * [.addItemsToZip()](#SolidFileClient+addItemsToZip) * [.zipItemLinks(zip, itemLinks, itemName)](#SolidFileClient+zipItemLinks) * [.extractZipArchive(zip, destination, options)](#SolidFileClient+extractZipArchive) ⇒ * [.uploadExtractedZipArchive(zip, destination, curFolder, responses, options)](#SolidFileClient+uploadExtractedZipArchive) ⇒ promise * [._uploadLinkFile()](#SolidFileClient+_uploadLinkFile) ### new SolidFileClient(auth, [options]) | Param | Type | Description | | --- | --- | --- | | auth | SolidAuthClient | An auth client, for instance solid-auth-client or solid-auth-cli | | [options] | [SolidFileClientOptions](#SolidFileClientOptions) | | ### solidFileClient.readFile(url, [request]) ⇒ Promise.<(string\|Blob\|Response)> Fetch an item and return content as text,json,or blob as needed **Kind**: instance method of [SolidFileClient](#SolidFileClient) | Param | Type | | --- | --- | | url | string | | [request] | RequestInit | ### solidFileClient.readHead(url, options) ⇒ string read Head as string **Kind**: instance method of [SolidFileClient](#SolidFileClient) **Returns**: string - headStr | Param | Type | | --- | --- | | url | string | | options | object | ### solidFileClient.deleteFile(url) ⇒ Promise.<Response> delete file **Kind**: instance method of [SolidFileClient](#SolidFileClient) **Returns**: Promise.<Response> - response of the file deletion | Param | Type | | --- | --- | | url | string | ### solidFileClient.deleteFolder(url) ⇒ Promise.<Array.<Response>> Delete a folder, its contents and links recursively **Kind**: instance method of [SolidFileClient](#SolidFileClient) **Returns**: Promise.<Array.<Response>> - Resolves with an array of deletion responses. The first one will be the folder specified by "url". The others will be the deletion responses from the contents in arbitrary order | Param | Type | | --- | --- | | url | string | ### solidFileClient.aclUrlParser(url) ⇒ object ACL content url parser **Kind**: instance method of [SolidFileClient](#SolidFileClient) **Returns**: object - an acl object from url.acl | Param | Type | | --- | --- | | url | string | ### solidFileClient.getFolderItemList(path) ⇒ Promise.<Array.<Item>> Wrap API response for retrieving folder item list **Kind**: instance method of [SolidFileClient](#SolidFileClient) | Param | Type | | --- | --- | | path | String | ### solidFileClient.createZipArchive(resource, archiveUrl, options) ⇒ promise.<response> Request API to upload the items as zip archive zip file contains a blob (or a string if async blob is not supported like in jest tests) **Kind**: instance method of [SolidFileClient](#SolidFileClient) **Returns**: promise.<response> - res => { const success = await res.text() })>} | Param | Type | Description | | --- | --- | --- | | resource | string | path (file or folder) | | archiveUrl | string | .zip file url | | options | object | | ### solidFileClient.getAsZip() Wrap API response for zipping multiple items **Kind**: instance method of [SolidFileClient](#SolidFileClient) ### solidFileClient.addItemsToZip() Add items with links to a zip object recursively **Kind**: instance method of [SolidFileClient](#SolidFileClient) ### solidFileClient.zipItemLinks(zip, itemLinks, itemName) Add item links to a zip object **Kind**: instance method of [SolidFileClient](#SolidFileClient) | Param | Type | | --- | --- | | zip | object | | itemLinks | Array | | itemName | string | ### solidFileClient.extractZipArchive(zip, destination, options) ⇒ Wrap API response for extracting a zip archive unzip file is expecting a blob content (except if async blob is not supported like in jest tests) **Kind**: instance method of [SolidFileClient](#SolidFileClient) **Returns**: {promise<{ err: [], info: []}>) | Param | Type | Description | | --- | --- | --- | | zip | string | file | | destination | string | folder | | options | object | | **Properties** | Name | Type | | --- | --- | | ...unzipOptions | options | ### solidFileClient.uploadExtractedZipArchive(zip, destination, curFolder, responses, options) ⇒ promise Recursively upload all files and folders with links from an extracted zip archive **Kind**: instance method of [SolidFileClient](#SolidFileClient) | Param | Type | Description | | --- | --- | --- | | zip | object | | | destination | string | url | | curFolder | string | | | responses | Array | | | options | object | | ### solidFileClient.\_uploadLinkFile() Check that link content is valid and create link **Kind**: instance method of [SolidFileClient](#SolidFileClient) ## WriteOptions : object **Kind**: global typedef **Properties** | Name | Type | Default | Description | | --- | --- | --- | --- | | [createPath] | boolean | true | create parent containers if they don't exist | | [withAcl] | boolean | true | also copy acl files | | [agent] | AGENT | "no_modify" | specify how to handle existing .acl | | [withMeta] | boolean | true | also copy meta files | | [merge] | MERGE | "replace" | specify how to handle existing files/folders | ## ReadFolderOptions : object **Kind**: global typedef **Properties** | Name | Type | Default | | --- | --- | --- | | [links] | LINKS | "exclude" | ## SolidApiOptions : object **Kind**: global typedef **Properties** | Name | Type | Default | Description | | --- | --- | --- | --- | | [enableLogging] | boolean \| string | false | set to true to output all logging to the console or e.g. solid-file-client:fetch for partial logs | ## Links : object **Kind**: global typedef **Properties** | Name | Type | | --- | --- | | [acl] | string | | [meta] | string | ## Item : object **Kind**: global typedef **Properties** | Name | Type | | --- | --- | | url | string | | name | string | | parent | string | | itemType | "Container" \| "Resource" | | [links] | [Links](#Links) | ## FolderData : object **Kind**: global typedef **Properties** | Name | Type | | --- | --- | | url | string | | name | string | | parent | string | | links | [Links](#Links) | | type | "folder" | | folders | [Array.<Item>](#Item) | | files | [Array.<Item>](#Item) | ## fetch ⇒ Promise.<Response> (optionally authenticated) fetch method similar to window.fetch **Kind**: global typedef | Param | Type | | --- | --- | | url | string | | [options] | RequestInit | ## zipOptions : object - .acl write parameters **Kind**: global typedef **Properties** | Name | Type | Default | Description | | --- | --- | --- | --- | | [createPath] | boolean | true | create parent containers if they don't exist | | [links] | LINKS | "include" | | | [withAcl] | boolean | true | also copy acl files | | [withMeta] | boolean | true | also copy meta files | ## unzipOptions : object - .acl write parameters **Kind**: global typedef **Properties** | Name | Type | Default | Description | | --- | --- | --- | --- | | [createPath] | boolean | true | create parent containers if they don't exist | | [links] | LINKS | "include" | | | [withAcl] | boolean | true | also copy acl files | | [withMeta] | boolean | true | also copy meta files | | [merge] | MERGE | "replace" | specify how to handle existing files/folders - .acl content validation parameters | | [aclMode] | aclMode | "Control" | specify the minimal existing mode to validate ACL document | | [aclAuth] | aclAuth | "must" | should be "must" (actually NSS accepts "may" = absence of acl:Authorization) | | [aclDefault] | aclDefault | "must" | specify if acl:default is needed to validate ACL document | ## SolidFileClientOptions : object **Kind**: global typedef **Properties** | Name | Type | Default | Description | | --- | --- | --- | --- | | [enableLogging] | boolean \| string | false | true for all logging or e.g. solid-file-client:fetch for partial logs |