Angular: ajenti.filesystem

Services

class filesystem()
read(path)
Returns:promise → content of path
write(path, content)
Returns:promise
list(path)
Returns:promise → array
stat(path)
Returns:promise → object
chmod(path, mode)
Arguments:
  • mode (int) – numeric POSIX file mode
Returns:

promise

createFile(path, mode)
Arguments:
  • mode (int) – numeric POSIX file mode
Returns:

promise

createDirectory(path, mode)
Arguments:
  • mode (int) – numeric POSIX file mode
Returns:

promise

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 a path 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>

Comments

comments powered by Disqus