Skip to content

Commit 8f5a043

Browse files
save file
1 parent abb996f commit 8f5a043

File tree

1 file changed

+123
-45
lines changed

1 file changed

+123
-45
lines changed
Lines changed: 123 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
## Description
22

3-
The web-console provides a console ( like dev tools ) in a webpage
3+
The file-mod manages file access
44

55

66
## Include
77

8+
requires component v3.0
9+
810
```
911
10-
<web-console component></web-console>
12+
<file-mod component></file-mod>
1113
1214
```
1315

@@ -16,28 +18,28 @@ The web-console provides a console ( like dev tools ) in a webpage
1618

1719
name | description
1820
----------|------------
19-
$ | the dom helper library
20-
ace | a global reference to ace editor, otherwise each instance of the web-console will load its own ace editor, specifying this ensures its only loaded once
21-
embed | allows reading the supported attributes from another node
22-
config | config parameters, see below
23-
echo | whether to echo the output to the dev tools console
24-
21+
ext | helper loader library
22+
$ | various dom helper functions
23+
menumod | the menumod library
24+
|
25+
menu | reference to the menu to add its menu's to
26+
source | the source text
27+
focus | function to reset focus
28+
log | reference to log-mod component
29+
|
30+
complete | handles loading ( complete.load ) and saving ( complete.save )
2531

26-
## api
2732

28-
### attribute
33+
## attribute
2934

3035
these attribute can be defined on the html tag itself
3136

3237
attribute | description
3338
--------- |-----------
34-
fullsize | the console will keep expanding to show all content
35-
h \| height | sets the height of the console
36-
39+
none | no supported attributes
3740

38-
### module
3941

40-
methods without a description are not currently implmented and are passed through to dev tools
42+
## module
4143

4244

4345
name|description
@@ -47,33 +49,109 @@ initmod|standard function for importing local dependencies
4749
init|standard initialisation function
4850
initdom|standard function to setup the dom
4951
|
50-
**console** |
51-
assert|
52-
clear|clear the console
53-
count|
54-
countReset|
55-
debug|write debug information to the console
56-
dir|
57-
dirxml|
58-
error|display error information in the console
59-
group|
60-
groupCollapsed|
61-
groupEnd|
62-
info|
63-
log|log data to the console
64-
profile|
65-
profileEnd|
66-
table|
67-
time|
68-
timeEnd|
69-
timeLog|
70-
timeStamp|
71-
trace|
72-
warn|display warn information in the console
73-
|
74-
**extended** |
75-
write|write to the console, without adding a newline character at the end of the output
76-
json|write json stringified output to the console
77-
|
78-
|
79-
test|display test data in the console, for quick tests
52+
save ( file ) | read source blob and save under *file* or current file
53+
clear () | clear the current file
54+
new ( ...opts ) | alias for newfile
55+
[newfile](#file-descriptor) ( ...opts ) | create a new file desciptor object
56+
export ( file ) | serialise *file*
57+
import ( file ) | deserialise *file*
58+
test()|display test data
59+
60+
61+
## api
62+
63+
64+
### save ( file )
65+
66+
reads a blob from source and saves it according to the file descriptor, then calls complete.save( file )
67+
68+
69+
### clear ( )
70+
71+
clear the current file. file-mod maintains a reference to the current file so that save can be called
72+
externally, ie say ctrl-s
73+
74+
75+
### new ()
76+
77+
alias for newfile
78+
79+
80+
81+
82+
<!--
83+
84+
### doThing(input, [options], ...extras)
85+
86+
Performs the main operation.
87+
88+
#### Parameters
89+
- **input** — string or object to process
90+
- **[options]** — optional settings
91+
- **[options.mode="fast"]** — processing mode
92+
- **[options.verbose=false]** — enable verbose output
93+
- **...extras** — additional values appended to the operation
94+
95+
#### Returns
96+
- **Promise<Result>**
97+
98+
#### Result
99+
- **success** — boolean indicating whether the operation succeeded
100+
- **value** — the processed output
101+
- **warnings** — array of strings describing non‑fatal issues
102+
- **durationMs** — number of milliseconds the operation took
103+
104+
#### Errors
105+
The promise rejects with:
106+
- **TypeError** — thrown when `input` is missing or invalid
107+
- **OperationError** — thrown when processing fails internally
108+
- **TimeoutError** — thrown when the operation takes too long
109+
110+
-->
111+
112+
113+
114+
<div id=file-descriptor style='scroll-margin-top: 80px'>
115+
116+
### newfile ({filetype,path,name,rel,kind,size,ctime,mtime,atime,title,icon})
117+
118+
</div>
119+
120+
create a file descriptor object
121+
122+
#### Parameters
123+
124+
- **filetype || ft** = the filetype ( localfile,github,googlestorage ... )
125+
126+
- **abs** = the absolute path of the file
127+
128+
- **path** = path of the file
129+
130+
- **name** = the name of the file
131+
132+
- **rel** = relative path for the file, should this be relevant
133+
134+
- **kind** = kind of file structure this file object represents ( file,directory )
135+
136+
- **size** = the size of the file in bytes
137+
138+
- **ctime** = the create time of the file
139+
140+
- **mtime** = the modified time of the file
141+
142+
- **atime** = the last access time of the file
143+
144+
- **title** = the title for the file
145+
146+
- **icon** = an icon for the file
147+
148+
#### Returns
149+
150+
- **Object** — the file descriptor
151+
152+
#### Errors
153+
- **none**
154+
155+
### export ( [file] )
156+
157+
serialise and return file or the current file

0 commit comments

Comments
 (0)