url-resolver-fs v8.0.6
url-resolver-fs
resolves urls and provides fs like access
API
Table of Contents
Resolver
Extends URLScheme
Holds a map of url-schemes and dispatches requests
Parameters
configObject (optional, default{})predefinedConstructorsArray<URLScheme> schemes to start with (optional, default[])envObject environment variables as present in process.env (optional, default{})
Properties
registerScheme
Register a scheme for later lookup
Parameters
schemeURLScheme
schemeForURL
Get URLScheme for a given url
Parameters
urlURL
Returns URLScheme for a given url or undefined if nothing found
resolve
Resolve for a given url. Passes url to the registered scheme for remapping
Parameters
urlURL to be resolved
Returns URL resolved url or original URL if no remapping found
createContext
Create a new context
Parameters
optionsObject context
Returns Context newly created context
provideCredentials
Called when authorization is required. Forwards the request to the registered auth providers
Parameters
realmstring requested realm
Returns Object credentials as given by one of the registered auth providers
Context
Holds context information
Parameters
Properties
base
Type: URL
resolve
Parameters
urlURL
Returns URL
provideCredentials
Called when authorization is required for a given realm asks options.provideCredentials() and resolver.provideCredentials()
Parameters
realmObject requested (decoded) realm
Returns Promise<Object> credentials for the given realm
HTTPScheme
Extends URLScheme
URLScheme for http requests
Parameters
Properties
optionsObject
fetch
Parameters
Returns Promise fetch result
get
Execute a GET request
Parameters
Returns Promise body of the response
put
Execute a PUT request
Parameters
contextContext execution contexturlURL destinationstreamStream content to be put to the urloptionsObject
stat
Execute a HEAD request
Parameters
Returns Object response object
addAuthorizationHeader
inserts the authorization data into the reguest header
Parameters
Returns boolean true if auth info has been written into headers
name
Returns string 'http'
defaultPort
Returns number 80 the http default port
optionsFromEnvironment
Extract options suitable for the constructor form the given set of environment variables
Parameters
envObject
Returns Object undefined if no suitable environment variables have been found
HTTPSScheme
Extends HTTPScheme
URLScheme for https requests
name
Returns string 'https'
defaultPort
Returns number 443 the https default port
isSecure
Returns boolean true
URLScheme
Parameters
optionsObject raw config
Properties
optionsObject raw config
name
Should be overwritten to reflect the scheme name
Returns string scheme name (defaults to the class name)
defaultPort
Returns number default from static defaultPort
isSecure
Returns boolean default from static isSecure
list
List collection (directory)
Parameters
Returns Promise resolves to iterable entries
get
Get content of a url
Parameters
Returns Promise resolves to the content
stat
Delivers meta information for a given url
Parameters
Returns Promise resolves to one entry
put
Put the content of a stream to a given url
Parameters
Returns Promise resolves if stream has ben put to the url
delete
Deletes object at a given url
Parameters
Returns Promise resolves to the history of the object at the given url
history
Deliver history information for a given url
Parameters
Returns Promise resolves to the history of the object at the given url
provideCredentials
Called when authorization is required for a given realm Tries provideCredentials() on the options object first and then calls provideCredentials() on the context.
Parameters
Returns Promise<Object> holding the credentials
methods
supported methods
Returns Array<string> 'get', 'stat', 'put', 'delete', 'list', 'history'
isSecure
Returns boolean false
defaultPort
Returns mumber undefined by default
defaultOptions
Default configuration options
Returns Object
optionsFromEnvironment
Extract options suitable for the constructor form the given set of environment variables
Parameters
envObject
Returns Object undefined if no suitable environment variables have been found
options
Pepare configuration by mixing together defaultOptions with actual options
Parameters
optionsObject raw config
Returns Object combined options
URLMapperScheme
Extends URLScheme
Remap url special:some/path -> https://myserver.com/repo/some/path name: special baseScheme: https prefix: https://myserver.com/repo/
Parameters
baseSchemeURLSchemenamestring of the newly created schemeprefixstring urls will be prefixed by this valueoptions
Properties
baseSchemeURLSchemenamestring of the newly created schemeprefixstring urls will be prefixed by this value
remap
Remapps url by separating scheme (and direct following '/') from suffix and appending the suffix (in front)
Parameters
urlURL to be remapped
Returns URL remapped url
parseAuthenticate
- See: rfc7235
Parse WWW-Authenticate header and provide parts as object. provides a two level structure 1st. the algorithm and then the algorithm attributes
Parameters
sourcestring http header 'WWW-Authenticate'resultObject where to put result into (optional, default{})
Returns Object same as result
ResponseError
Extends Error
general fetch response error
install
With npm do:
npm install url-resolver-fslicense
BSD-2-Clause
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
