Quark
#
Modules #
quark/actionquark/appquark/bubblesquark/bufferquark/checkboxquark/cssquark/ctrquark/dialogquark/eventquark/fontquark/fsquark/hashquark/httpquark/indexquark/jsonbquark/keyboardquark/mediaquark/navquark/netquark/osquark/pathquark/pkgquark/screenquark/stepperquark/storagequark/testquark/typesquark/utilquark/viewquark/windowquark/wsquark/_bufferquark/_commonquark/_eventquark/_extquark/_md5quark/_sha1quark/_sha256quark/_utilquark/_watching
Quark v1.3.0 Documentation
Table of Contents
-
quark/path
-
Class: URL
- URL
- url.constructor(path?)
- url.href
- url.filename
- url.path
- url.dirname
- url.search
- url.hash
- url.host
- url.hostname
- url.origin
- url.basename
- url.extname
- url.port
- url.protocol
- url.params
- url.hashParams
- url.getParam(name)
- url.setParam(name,value)
- url.deleteParam(name)
- url.clearParams()
- url.getHash(name)
- url.setHash(name,value)
- url.deleteHash(name)
- url.clearHashs()
- url.relative(fromPath)
- url.toJSON()
-
default
- default.executable()string
- default.documents(path?)
- default.temp(path?)
- default.resources(path?)
- default.cwd()string
- default.chdir(path)
- default.normalizePath(path,retain_up?)
- default.classicPath(path)
- default.resolve(path,partPath?string)
- default.isAbsolute(path)
- default.basename(path?)
- default.dirname(path?)
- default.extname(path?)
- default.filename(path?)
- default.path(path?)
- default.search(path?)
- default.hash(path?)
- default.host(path?)
- default.hostname(path?)
- default.origin(path?)
- default.port(path?)
- default.protocol(path?)
- default.params(path?)
- default.hashParams(path?)
- default.getParam(name,path?)
- default.setParam(name,value,path?)
- default.deleteParam(name,path?)
- default.clearParams(path?)
- default.getHash(name,path?)
- default.setHash(name,value,path?)
- default.deleteHash(name,path?)
- default.clearHashs(path?)
- default.relative(from,target?)
-
Class: URL
quark/path #
Class: URL #
URL #
URL Processing Tool Type
For example:
// cwd: file:///var/data
// Prints: file:///var/data/index.js
var uri = new URL('index.js');
console.log(uri.href);
// Prints: http://quarks.cc/index.html?args=0
var uri2 = new URL('http://quarks.cc/home/../index.html?args=0')
console.log(uri2.href);
// Prints:
// Error: Parse uri error, Illegal URL
new URL('http://quarks.cc:').href
url.constructor(path?) #
@parampath?:string
url.href #
Get the complete URL, including parameters
href: "http://xxxx.xxx:81/v1.1.0/quark/path.js?sasasas&asasasa#sdsdsd"
@gethref:string
For example:
// Prints: http://quarks.cc/
console.log(new URL('http://quarks.cc/').href);
url.filename #
Get full path name
filename: "/D:/Documents/test.js"
@getfilename:string
For example:
// Prints: /aaa/bbbb/ccc/test.js
console.log(new URL('http://quarks.cc/aaa/bbbb/ccc/test.js').filename);
url.path #
@getpath:string/a/b/s/test.html?aaaaa=100
For example:
// Prints: /aaa/bbbb/ccc/test.js?asas=asas
console.log(new URL('http://quarks.cc/aaa/bbbb/ccc/test.js?asas=asas').path);
url.dirname #
Full path dir
dirname: "/D:/Documents"
@getdirname:string
For example:
// Prints: /aaa/bbbb/ccc
console.log(new URL('http://quarks.cc/aaa/bbbb/ccc/test.js').dirname);
url.search #
Get url query parameters
search: "?sasasas&asasasa"
@getsearch:string
For example:
// Prints: ?a=A&b=B
console.log(new URL('http://quarks.cc/?a=A&b=B').search);
url.hash #
hash: "#sdsdsd"
Get hash parameters
@gethash:string
For example:
// Prints: #c=C&d=D
console.log(new URL('http://quarks.cc/?a=A&b=B#c=C&d=D').hash);
url.host #
host: "quarks.cc:81"
Gets the host name and returns the host name with the port number
@gethost:string
For example:
// Prints: quarks.cc:80
console.log(new URL('http://quarks.cc:81/').host);
url.hostname #
hostname: "quarks.cc"
Gets the host name, but does not return the port number
@gethostname:string
For example:
// Prints: quarks.cc
console.log(new URL('http://quarks.cc:81/').host);
url.origin #
origin: "http://quarks.cc:81"
Get the uri origin, protocol+host
@getorigin:string
For example:
// Prints: http://quarks.cc:81
console.log(new URL('http://quarks.cc:81/host/index.html').host);
// Prints: file://
console.log(new URL('file:///var/data/index.html').host);
url.basename #
Get path base name
@getbasename:string
For example:
// Prints: index.html
console.log(new URL('file:///var/data/index.html').basename);
url.extname #
Get path extname
@getextname:string
For example:
// Prints: .html
console.log(new URL('file:///var/data/index.html').extname);
url.port #
port: "81"
Get the host port number.
If the port number is not defined in the URL, an empty string is returned.
@getport:string
For example:
// Prints: 81
console.log(new URL('http://quarks.cc:81').port);
// Prints If there is no port number, an empty string will be returned: ""
console.log(new URL('http://quarks.cc').port);
url.protocol #
Get the protocol type string of the URL, For: 'http:'|'https'|'ftp:'
@getprotocol:string
url.params #
Returns a collection of query parameters as an object, or set
@getparams:Dict<string>
For example:
// Prints:
// {
// a: "100",
// b: "test"
// }
console.log(new URL('http://quarks.cc/?a=100&b=test').params);
url.hashParams #
Returns a Hash parameter set as an object, or set
@gethashParams:Dict<string>
For example:
// Prints:
// {
// a: "200",
// b: "300"
// }
console.log(new URL('http://quarks.cc/#a=200&b=300').hashParams);
url.getParam(name) #
Get path param
For example:
// Prints: ok
console.log(new URL('http://quarks.cc/?args=ok').getParam('args'));
url.setParam(name,value) #
Set the URL query parameter key-value pair and return self
url.deleteParam(name) #
Remove URL query parameters by name
url.clearParams() #
Delete all of params in the URL
@returnthis
url.getHash(name) #
Get hash param by name
url.setHash(name,value) #
Set hash param by the key/value
url.deleteHash(name) #
Delete hash param by the name
url.clearHashs() #
Delete all of hash params in the URL
@returnthis
url.relative(fromPath) #
Get relative path from the fromPath to self
For example:
// Prints: ../A/B/C/test.js
var url = new URL('http://quarks.cc/A/B/C/test.js');
console.log(url.relative('http://quarks.cc/home/'));
// Prints: file:///var/data/A/B/C/test.js
var url2 = new URL('file:///var/data/A/B/C/test.js');
console.log(url2.relative('http://quarks.cc/home/'));
url.toJSON() #
@returnstring
default #
default.executable()string #
Get the binary executable file path of the current application
For example:
// Prints:
// file:///var/containers/Bundle/Application/4F1BD659-601D-4932-8484-D0D1F978F0BE/test.app/test
console.log(path.executable());
@returnstring
default.documents(path?) #
Get the document storage path of the current application
@parampath?:stringAppend to the document path
For example:
// Prints:
// file:///var/mobile/Containers/Data/Application/89A576FE-7BB9-4F26-A456-E9D7F8AD053D/Documents
console.log(path.documents());
// Prints Setting the result of appending path parameters:
// file:///var/mobile/Containers/Data/Application/89A576FE-7BB9-4F26-A456-E9D7F8AD053D/Documents/aa.jpeg
console.log(path.documents('aa.jpeg'));
@returnstring
default.temp(path?) #
Get the application temporary directory
default.resources(path?) #
Get the application resource directory
default.cwd()string #
Get the current working directory
@returnstring
default.chdir(path) #
Set the current working directory and return true if successful
default.normalizePath(path,retain_up?) #
Format part path to normalize path
default.classicPath(path) #
Restore the path to a path that the operating system can recognize.
Generally, you do not need to call this function unless you directly call
a Native/C/C++ function that is not provided by Quark
For example:
// Prints: /var/data/test.js
console.log(path.normalizePath('file:///var/data/test.js'));
default.resolve(path,partPath?string) #
Format path to standard absolute path
For example:
// Prints: http://quarks.cc/A/C/test.js
console.log(path.resolve('http://quarks.cc/home', "..", "A", "B", "..", "C", "test.js"));
// Prints:
// true
// file:///var/data/aaa/cc/ddd/kk.jpg
console.log(path.chdir('/var/data'));
console.log(path.resolve('aaa/bbb/../cc/.//!<ddd/kk.jpg'));
default.isAbsolute(path) #
Test whether it is an absolute path
For example:
// Prints:
// true
// true
// false
console.log(path.isAbsolute('/var/kk'));
console.log(path.isAbsolute('http://quarks.cc/'));
console.log(path.isAbsolute('index.jsx'));
default.basename(path?) #
Get basename
default.dirname(path?) #
Get dirname
default.extname(path?) #
Get extname
default.filename(path?) #
Get filename
default.path(path?) #
Get path
default.search(path?) #
Get search
default.hash(path?) #
Get hash
default.host(path?) #
Get host
default.hostname(path?) #
Get hostname
default.origin(path?) #
Get origin
default.port(path?) #
Get port: "81"
default.protocol(path?) #
Get protocol: "http:"
default.params(path?) #
Get params
default.hashParams(path?) #
Get params
default.getParam(name,path?) #
Get path param
default.setParam(name,value,path?) #
Set path param
default.deleteParam(name,path?) #
Delete path param
default.clearParams(path?) #
Delete all of hash params
default.getHash(name,path?) #
Get hash param
default.setHash(name,value,path?) #
Set hash param
default.deleteHash(name,path?) #
Delete hash param
default.clearHashs(path?) #
Delete all of hash params
default.relative(from,target?) #
Get relative path