A Javascript library for creating and managing files and folders in Solid data stores
SolidApi
Class for working with files on Solid Pods
object
object
object
object
object
object
Promise.<Response>
(optionally authenticated) fetch method similar to window.fetch
object
object
object
Kind: global class
Promise.<Response>
Promise.<Response>
Promise.<Response>
Promise.<Response>
Promise.<Response>
Promise.<Response>
Promise.<Response>
Promise.<Response>
Promise.<boolean>
Promise.<Response>
Promise.<Response>
Promise.<Response>
Promise.<Response>
Promise.<Response>
Promise.<Response>
Promise.<FolderData>
Promise.<Links>
Promise.<Response>
Promise.<(Response\|undefined)>
Promise.<Response>
Promise.<Array.<Response>>
Promise.<Array.<Response>>
Promise.<Array.<Response>>
Promise.<Array.<Response>>
Promise.<Array.<Response>>
Promise.<Array.<Response>>
Promise.<Array.<Response>>
Provide API methods which use the passed fetch method constructor adds :
Param | Type |
---|---|
fetch | fetch |
[options] | SolidApiOptions |
Promise.<Response>
Fetch a resource with the passed fetch method
Kind: instance method of SolidAPI
Returns: Promise.<Response>
- resolves if response.ok is true, else rejects the response
Param | Type |
---|---|
url | string |
[options] | RequestInit |
Promise.<Response>
Send get request
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
[options] | RequestInit |
Promise.<Response>
Send delete request
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
[options] | RequestInit |
Promise.<Response>
Send post request
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
[options] | RequestInit |
Promise.<Response>
Send put request
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
[options] | RequestInit |
Promise.<Response>
Send patch request
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
[options] | RequestInit |
Promise.<Response>
Send head request
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
[options] | RequestInit |
Promise.<Response>
Send options request
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
[options] | RequestInit |
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
Param | Type |
---|---|
url | string |
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
Param | Type | Description |
---|---|---|
url | string |
|
content | Blob | string |
|
contentType | string |
|
link | string |
header for Container/Resource, see LINK in apiUtils |
[options] | WriteOptions |
only uses createPath option |
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
Returns: Promise.<Response>
- Response of HEAD request if it already existed, else of creation request
Param | Type |
---|---|
url | string |
[options] | WriteOptions |
Promise.<Response>
Create a new file.
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
content | Blob | String |
[options] | WriteOptions |
Promise.<Response>
Create a new file. Per default it will overwrite existing files
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
content | Blob | String |
[options] | WriteOptions |
Promise.<Response>
Create a file using PUT Per default it will overwrite existing files
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
content | Blob | String |
[options] | WriteOptions |
Promise.<Response>
Update a file using PATCH
Kind: instance method of 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’ |
Promise.<FolderData>
Fetch and parse a folder
Kind: instance method of SolidAPI
Param | Type |
---|---|
url | string |
[options] | ReadFolderOptions |
Promise.<Links>
Get acl and meta links of an item
Kind: instance method of SolidAPI
Param | Type | Description |
---|---|---|
url | string |
|
[options] | object |
- specify if links should be checked for existence or not - may select acl or meta only |
Promise.<Response>
Copy a file. Per default overwrite existing files and copy links too.
Kind: instance method of 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 |
Promise.<(Response\|undefined)>
Copy a meta file
Kind: instance method of SolidAPI
Returns: Promise.<(Response\|undefined)>
- creation response
Param | Type |
---|---|
oldTargetFile | string |
newTargetFile | string |
[options] | WriteOptions |
Promise.<Response>
Copy an ACL file
Kind: instance method of 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 |
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
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 |
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
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 |
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
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 |
Promise.<Array.<Response>>
Delete all folders and files inside a folder
Kind: instance method of SolidAPI
Returns: Promise.<Array.<Response>>
- Resolves with a response for each deletion request
Param | Type |
---|---|
url | string |
Promise.<Array.<Response>>
Delete a folder, its contents and links recursively
Kind: instance method of 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 |
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
Returns: Promise.<Array.<Response>>
- Responses of the copying
Param | Type |
---|---|
from | string |
to | string |
[copyOptions] | WriteOptions |
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
Returns: Promise.<Array.<Response>>
- Response of the newly created items
Param | Type |
---|---|
url | string |
newName | string |
[moveOptions] | RequestOptions |
SolidApi
Class for working with files on Solid Pods
Kind: global class
Extends: SolidApi
SolidApi
Promise.<(string\|Blob\|Response)>
string
Promise.<Response>
Promise.<Array.<Response>>
object
Promise.<Array.<Item>>
promise.<response>
promise
Param | Type | Description |
---|---|---|
auth | SolidAuthClient |
An auth client, for instance solid-auth-client or solid-auth-cli |
[options] | SolidFileClientOptions |
Promise.<(string\|Blob\|Response)>
Fetch an item and return content as text,json,or blob as needed
Kind: instance method of SolidFileClient
Param | Type |
---|---|
url | string |
[request] | RequestInit |
string
read Head as string
Kind: instance method of SolidFileClient
Returns: string
- headStr
Param | Type |
---|---|
url | string |
options | object |
Promise.<Response>
delete file
Kind: instance method of SolidFileClient
Returns: Promise.<Response>
- response of the file deletion
Param | Type |
---|---|
url | string |
Promise.<Array.<Response>>
Delete a folder, its contents and links recursively
Kind: instance method of 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 |
object
ACL content url parser
Kind: instance method of SolidFileClient
Returns: object
- an acl object from url.acl
Param | Type |
---|---|
url | string |
Promise.<Array.<Item>>
Wrap API response for retrieving folder item list
Kind: instance method of SolidFileClient
Param | Type |
---|---|
path | String |
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
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 |
Wrap API response for zipping multiple items
Kind: instance method of SolidFileClient
Add items with links to a zip object recursively
Kind: instance method of SolidFileClient
Add item links to a zip object
Kind: instance method of SolidFileClient
Param | Type |
---|---|
zip | object |
itemLinks | Array |
itemName | string |
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
Returns: {promise<{ err: [], info: []}>)
Param | Type | Description |
---|---|---|
zip | string |
file |
destination | string |
folder |
options | object |
Properties
Name | Type |
---|---|
…unzipOptions | options |
promise
Recursively upload all files and folders with links from an extracted zip archive
Kind: instance method of SolidFileClient
Param | Type | Description |
---|---|---|
zip | object |
|
destination | string |
url |
curFolder | string |
|
responses | Array |
|
options | object |
Check that link content is valid and create link
Kind: instance method of SolidFileClient
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 |
object
Kind: global typedef
Properties
Name | Type | Default |
---|---|---|
[links] | LINKS |
"exclude" |
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 |
object
Kind: global typedef
Properties
Name | Type |
---|---|
[acl] | string |
[meta] | string |
object
Kind: global typedef
Properties
Name | Type |
---|---|
url | string |
name | string |
parent | string |
itemType | "Container" | "Resource" |
[links] | Links |
object
Kind: global typedef
Properties
Name | Type |
---|---|
url | string |
name | string |
parent | string |
links | Links |
type | "folder" |
folders | Array.<Item> |
files | Array.<Item> |
Promise.<Response>
(optionally authenticated) fetch method similar to window.fetch
Kind: global typedef
Param | Type |
---|---|
url | string |
[options] | RequestInit |
object
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 |
object
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 |
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 |