Angular: ajenti.filesystem¶
Services¶
-
class
filesystem
()¶ -
filesystem.
read
(path)¶ Returns: promise → content of path
-
filesystem.
write
(path, content)¶ Returns: promise
-
filesystem.
list
(path)¶ Returns: promise → array
-
filesystem.
stat
(path)¶ Returns: promise → object
-
filesystem.
chmod
(path, mode)¶ Arguments: - mode (int) – numeric POSIX file mode
Returns: promise
-
filesystem.
createFile
(path, mode)¶ Arguments: - mode (int) – numeric POSIX file mode
Returns: promise
-
filesystem.
createDirectory
(path, mode)¶ Arguments: - mode (int) – numeric POSIX file mode
Returns: promise
-
filesystem.
downloadBlob
(content, mime, name)¶ Launches a browser-side file download
Arguments: - content (string) – Raw file content
- mime (string) – MIME type used
- name (string) – Default file name for saving
Returns: promise
-
Directives¶
-
file-dialog
()¶ File open/save dialog. Example:
<file-dialog mode="open" ng:show="openDialogVisible" on-select="open(item.path)" on-cancel="openDialogVisible = false"> </file-dialog> <file-dialog mode="save" ng:show="saveDialogVisible" on-select="saveAs(path)" on-cancel="saveDialogVisible = false" name="saveAsName"> </file-dialog>
Arguments: - ngShow (expression) –
- onSelect (expression(item)) – called after opening or saving a file.
item
is an object with apath
property. - onCancel (expression) – (optional) handler for the cancel button
- mode (string) – one of
open
,save
- name (binding) – (optional) name for the saved file
- path (binding) – (optional) current
-
path-selector
()¶ An input with a file selection dialog:
<path-selector ng:model="filePath"></path-selector>